find_next_bit_wrap(9)
π find_next_bit_wrap β find the next set bit in a memory region
okay bestie, this one's a little kernel function from the Kernel API Manual and honestly? she's giving "wrap around the bitmap and find me a vibe" β¨ like she searches a memory region for the next set bit, and if there's nothing ahead of you, she loops back around to the front. iconic behavior honestly π
β¨ SYNOPSIS β¨
unsigned long find_next_bit_wrap (const unsigned long *addr , unsigned long size , unsigned long offset );
like yes that's the whole signature, she's not complicated π
πΈ ARGUMENTS πΈ
addrβ the address you're basing the search on π«Ά like, where the memory region lives, that's her home basesizeβ the bitmap size in bits (bits!! not bytes!! don't come for me) πoffsetβ the bitnumber you start searching at π like, "begin the hunt here bestie"
π DESCRIPTION π
so here's the tea β: she returns the bit number for the next set bit, or the first set bit up to offset β that's the wrap part, she goes around π and if literally no bits are set? she returns size. that's it, that's the whole mood. no bits, no problem, you get size back π
lowkey the "wrap" in the name is doing a lot of work here β she checks forward from offset, then loops back to the start of the region. bestie's got range π
π¦ SEE ALSO π¦
Kernel file ./include/linux/find.h β that's where the whole friend group lives π‘β¨
find_next_bit(9)find_next_and_bit(9)find_next_andnot_bit(9)find_next_or_bit(9)find_next_zero_bit(9)find_first_bit(9)find_nth_bit(9)find_nth_and_bit(9)find_nth_and_andnot_bit(9)find_first_and_bit(9)find_first_andnot_bit(9)find_first_and_and_bit(9)find_first_zero_bit(9)find_last_bit(9)find_next_and_bit_wrap(9)find_next_clump8(9)for_each_set_bitrange(9)for_each_set_bitrange_from(9)for_each_clear_bitrange(9)for_each_clear_bitrange_from(9)for_each_set_bit_wrap(9)for_each_set_clump8(9)
like that's the entire group chat and they're all invited to the function π no cap, go read them all.
and that's the whole page babes π this queen ships out of ./include/linux and she's dated October 2026 β yeah, from the future, main character energy fr fr ππ
mwah, go find some bits π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms