CK_HS_GROW(3)
π CK_HS_GROW π
okay bestie, gather round, because we're about to talk about the glow-up function of the Concurrency Kit hash set world π¦
This page lives in the Concurrency Kit β that's libck, and you link it with -lck, no cap π
β¨ SYNOPSIS β¨
#include <ck_hs.h>
bool
ck_hs_grow(ck_hs_t *hs, unsigned long capacity);
πΈ DESCRIPTION πΈ
So ck_hs_grow(3) is literally the function that makes your hash set β¨biggerβ¨. It resizes the hash set so it can store at least the number of entries you pass in as capacity β and it does that at a load factor of one. iconic behavior honestly π
quick lil reminder though: the default hash set load factor is 0.5, not 1. so yeah, she's a little roomier than default by design π«Ά
now here's the tea β β if you want to minimize the likelihood of memory allocations for a hash set that's meant to store n entries, then you should specify a capacity of 2n. that's the move, fr fr.
and one more thing: the default behavior of ck_hs is to round capacity up to the next power of two if it's not already a power of two. so don't be surprised when your cute lil number comes back different π it's giving mathematically responsible.
π RETURN VALUES π
- If everything goes great,
ck_hs_grow(3)returnstrueπ - If it does not go great, it returns
falseπ
that's it. that's the whole vibe check.
π ERRORS π
β οΈ Behavior is undefined if hs is uninitialized. like, genuinely undefined. don't do it. this is not a drill, bestie π
and the only reason this function will return false is if there are internal memory allocation failures. so if it fails, it's not you, it's the memory π
π SEE ALSO π
the whole squad, obviously:
ck_hs_init(3)ck_hs_move(3)ck_hs_destroy(3)CK_HS_HASH(3)ck_hs_iterator_init(3)ck_hs_next(3)ck_hs_get(3)ck_hs_put(3)ck_hs_put_unique(3)ck_hs_set(3)ck_hs_fas(3)ck_hs_remove(3)ck_hs_rebuild(3)ck_hs_gc(3)ck_hs_count(3)ck_hs_reset(3)ck_hs_reset_size(3)ck_hs_stat(3)
and if you want even more, there's additional information available at http://concurrencykit.org/ π
okay that's the whole page, ily, go grow your hash set responsibly πβ¨ππ¦πΈπ π«Ά
this lil masterpiece was dated September 17, 2012, and it's the CK_HS_GROW(3) page β periodt. π
π¦ where this page comes from
- alpine 3.24: ck-doc 0.7.2-r1 Β· BSD-2-Clause AND Apache-2.0
- debian bookworm: libck-dev 0.7.1-10 Β· BSD-2-Clause
- debian trixie: libck-dev 0.7.2-6 Β· BSD-2-Clause
- epel 10: ck-devel 0.7.2-1.el10_1 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- epel 9: ck-devel 0.7.0-10.el9 Β· BSD
- fedora 43: ck-devel 0.7.2-2.fc43 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 43: ck-devel 0.7.2-2.fc43 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- nixos 26.05: ck 0.7.2
- nixpkgs unstable: ck 0.7.2
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- ubuntu jammy: libck-dev 0.7.1-6ubuntu2 Β· BSD-2-Clause
- ubuntu noble: libck-dev 0.7.1-13build1 Β· BSD-2-Clause
- ubuntu questing: libck-dev 0.7.2-5ubuntu1
- ubuntu resolute: libck-dev 0.7.2-5ubuntu2 Β· BSD-2-Clause
- ubuntu stonking: libck-dev 0.7.2-11 Β· BSD-2-Clause
- Copyright 2012-2013 Samy Al Bahra
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms