ffz(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ffz(9) β€” like, the Kernel API Manual entry you didn't know you needed ✨

okay so bestie, gather round 🫢 this is a page straight out of the Kernel API Manual, and it's about one tiny little function that does exactly one tiny little thing. no cap, it's short, but it's iconic in its own way. let's get into it πŸ’–


🌸 NAME 🌸

ffz β€” find first zero bit in word

like, that's the whole job. she finds the first 0 in a word. main character energy, honestly πŸ‘‘


✨ SYNOPSIS ✨

ffz (word );

that's it. that's the whole call. the spacing is giving "i typed this at 3am" but we're keeping it exactly as-is, periodt πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • word β€” the word to search πŸ” that's the thing you're poking at to find your first zero bit. that's it, that's the argument.

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, ffz searches your word for the first zero bit. simple, cute, does what it says on the tin.

but β€” and this is the part where you gotta pay attention, bestie πŸ™ˆ β€” the behaviour is undefined if no zero exists. meaning if your word is all ones, there's no zero to find, and the function is just gonna do... something. we don't know what. nobody knows what. it's giving chaos.

⚠️ so seriously, your code should check against ~0UL first before you call this. if the word is all ones, don't call it. that's the vibe check you gotta pass before you're allowed in. no cap, this is the important bit 😭

πŸ’œ SEE ALSO πŸ’œ

  • the Kernel file ./arch/x86/include/asm/bitops.h β€” go read it, it's where the magic lives πŸ“‚βœ¨
  • __ffs(9)
  • ffs(9)
  • fls(9)
  • fls64(9)

all the bit-finding besties, reunited at last 🫢🌈


and that's the whole page, bestie πŸŽ€ short but slay. this little gem lives in ./arch/x86/include/asm, dated October 2026, and it's page ffz(9) of the Kernel API Manual β€” mwah, go find some zeroes responsibly πŸ’‹πŸ’–πŸ”₯

πŸ“¦ where this page comes from