find_next_andnot_bit(9)
π find_next_andnot_bit β the Kernel API Manual, bestie edition π
Okay so picture this: you've got two bitmaps, right? And you want the next set bit in the first one, but only if the matching bit in the second one is not set. That's the whole vibe. It's find_next_andnot_bit from the <purple>Kernel API Manual</purple> and honestly it's giving "set difference but make it bits". β¨
πΈ SYNOPSIS πΈ
unsigned long find_next_andnot_bit (const unsigned long *addr1 ,
const unsigned long *addr2 ,
unsigned long size ,
unsigned long offset );
Like, four whole arguments, no cap. Feed it the bits, tell it how big and where to start, and it hands you back an unsigned long. π«Ά
β¨ ARGUMENTS β¨
addr1β the first address, aka the bitmap you're actually basing the search on, bestie πaddr2β the second address, the bitmap whose bits get excluded. Everything set here is a no-go π«sizeβ the bitmap size, measured in bits (yes, bits, not bytes, don't come for me) πoffsetβ the bitnumber you wanna start searching at, lowkey your launch point π
π« DESCRIPTION π«
So it returns the bit number for the next set bit β but only the ones that are set in addr1 and not set in addr2. The way that it justβ¦ excludes, iconic behavior honestly.
And if, like, no bits are set? It returns size. That's the whole mood. No matches, you get size back, that's your signal, that's your answer, periodt. π
π¦ SEE ALSO π¦
Grab a snack, this list is a whole friend group. π
- Kernel file
./include/linux/find.hβ go say hi to it find_next_bit(9)find_next_and_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_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)
Lowkey a whole squad of bit-finders, and find_next_andnot_bit is the main character. Slay. π
Sign-off time, bestie π
This lil number lives in ./include/linux, it's dated October 2026, and it goes by find_next_andnot_bit(9) in case you need to @ it later. Byeee, 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