ffz(9)
π 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
- 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