__fls(9)
β¨ __fls β¨
okay so this is a page from the Kernel API Manual (yes, the kernel has lore and we're reading it π
) and it's about __fls, bestie. let's get into it.
πΈ NAME πΈ
__fls β find the last (most-significant) set bit in a long word π
π¦ SYNOPSIS π¦
unsigned int __fls (unsigned long word );
like, that's the whole signature. that's her. no cap. β¨
π ARGUMENTS π
wordβ the word you're searching π that's it, that's the argument, she's serving one single parameter and she doesn't need more π
π DESCRIPTION π
okay so listen closely because this part actually matters π«Ά β if there's no set bit in the word at all, the result is undefined. literally undefined. not "zero", not "whatever", undefined π so the docs are like: your code should check against 0 first.
π bestie do NOT skip the zero check. this is the "look both ways before crossing" of bitops. undefined behaviour is not a vibe, it's a jumpscare π
π₯ SEE ALSO π₯
- Kernel file
./include/asm-generic/bitops/builtin-__fls.hβ go read the source, iykyk πβ¨
and that's the whole page, gorgeous πΈ this one came from ./include/asm-generic/bitops and it's dated October 2026 β so yeah, the kernel docs said "see you in the future, babe" and honestly? iconic. signed, sealed, __fls(9) ππ
π¦ 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