__ffs(9)
π NAME π
okay so this is __ffs β the kernel API manual page for it, bestie β and it does exactly one thing: find the first bit in a word. that's it. that's the whole vibe. β¨
β¨ SYNOPSIS β¨
unsigned int __ffs (unsigned long word );
like literally that's the entire signature, copy it exactly please, no freestyling π
π ARGUMENTS π
wordβ the word you wanna search. that's the one. the word. the thing you're hunting through for that first lil bit π¦
π¦ DESCRIPTION π¦
so you hand it a word and it goes looking for the first bit. cute, simple, main character energy.
but β and this is the part where you gotta listen to me, fr fr β the behaviour is undefined if no bit exists. like, not "returns 0", not "returns -1", undefined. π so your code should check against 0 first before you even think about calling this. do the vibe check on zero. periodt. π
β οΈ no cap: no bit in the word = undefined behaviour. check against 0 first, always, i'm begging π«Ά
πΈ SEE ALSO πΈ
- Kernel file
./tools/include/asm-generic/bitops/__ffs.hβ go read the source, iykyk π
okay that's the whole page, you ate it, i'm obsessed π and just so we're cute and complete: this came from the source file ./tools/include/asm-generic/bi... and the date on it is October 2026 β so yeah, __ffs(9), fresh off the kernel API manual, slay πππ
π¦ 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