find_next_andnot_bit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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. πŸ’€

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