CK_BITMAP_NEXT(3)
π CK_BITMAP_NEXT β iterate to the next set bit in bitmap π
okay bestie, welcome to the ck_bitmap_next(3) page, she's a lil function from Concurrency Kit and she's here to walk you through your bits one at a time. no cap, this is genuinely one of the most useful lil guys in the whole bitmap family.
π LIBRARY
Concurrency Kit β link with libck, so slap a -lck on that compile line and you're golden. π«Ά
β¨ SYNOPSIS β¨
#include <ck_bitmap.h>
bool
ck_bitmap_next(ck_bitmap_t *bitmap, ck_bitmap_iterator_t iterator,
unsigned int *bit);
that's the whole vibe. one include, one call, endless possibilities. π
πΈ DESCRIPTION πΈ
okay so here's the tea. ck_bitmap_next() takes the iterator object that iterator points to and increments it so it points at the next set bit in the bitmap. she's literally just scooting your iterator along to the next 1. β¨
and if ck_bitmap_next() returns true? then the pointer that bit points to gets initialized to the number of the current set bit that the iterator object is now pointing at. so you get told which bit, not just that there is one. iconic behaviour honestly. π
π¨ IMPORTANT SIS: it is expected thatiteratorhas already been initialized using theck_bitmap_iterator_init(3)function. do not come in here with a raw uninitialized iterator, she will not be nice about it.
π RETURN VALUES π
- if
ck_bitmap_next()returnstrueβ the object pointed to bybitcontains a set bit. you got one, bestie! π - if
ck_bitmap_next()returnsfalseβ the value of the object pointed to bybitis undefined. like, genuinely undefined. don't look at it, don't touch it, don't make it your whole personality. π
π ERRORS
behavior is undefined if iterator or bitmap are uninitialized.
that's it, that's the error section. no error codes, no graceful fallback, just vibes and chaos. init your stuff fr fr. π
π SEE ALSO
your whole bitmap bestie squad, go read them all:
ck_bitmap_base(3)ck_bitmap_size(3)ck_bitmap_init(3)ck_bitmap_set(3)ck_bitmap_reset(3)ck_bitmap_clear(3)ck_bitmap_bits(3)ck_bitmap_buffer(3)ck_bitmap_iterator_init(3)
more info also lives at http://concurrencykit.org/ π
and that's a wrap on this lil cutie. she was documented on April 27, 2012 β a true vintage queen β and the footer of this page lowkey calls her CK_BITMAP_TEST(3) which is a whole different function name, but we don't gatekeep, we just note it and move on. π mwah, go iterate something. π¦
π¦ 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
- Copyright 2012-2013 Shreyas Prasad
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms