for_each_clear_bitrange(9)
β¨ for_each_clear_bitrange β¨
okay so real talk bestie, welcome to the Kernel API Manual β section 9 for all my fellow kernel girlies out there π
this one's about for_each_clear_bitrange, and it's honestly such a vibe once you get it.
πΈ NAME πΈ
for_each_clear_bitrange β iterate over all unset bit ranges [b; e) π
like, all of them. every single little stretch of zeroes. no bit left behind, fr fr.
π¦ SYNOPSIS π¦
for_each_clear_bitrange (b , e , addr , size );
that's the whole thing. four args, one macro, infinite potential β¨
π ARGUMENTS π
bβ bit offset of start of current bitrange (first unset bit). so like, where the clear zone begins πeβ bit offset of end of current bitrange (first set bit). where it ends, and yes, the[b; e)half-open thing meanseis not included, periodt πaddrβ bitmap address to base the search on. your actual bitmap, the main character of this whole operation πsizeβ bitmap size in number of bits. how far the search is allowed to wander, ngl don't let it roam past this π
π₯ SEE ALSO π₯
bestie there are SO many siblings in this family, it's giving huge family reunion energy π all chillin' in the Kernel file ./include/linux/find.h:
find_next_bit(9), find_next_and_bit(9), find_next_andnot_bit(9), find_next_or_bit(9), find_next_zero_bit(9), find_first_bit(9), find_nth_bit(9), find_nth_and_bit(9), find_nth_and_andnot_bit(9), find_first_and_bit(9), find_first_andnot_bit(9), find_first_and_and_bit(9), find_first_zero_bit(9), find_last_bit(9), find_next_and_bit_wrap(9), find_next_bit_wrap(9), find_next_clump8(9), for_each_set_bitrange(9), for_each_set_bitrange_from(9), for_each_clear_bitrange_from(9), for_each_set_bit_wrap(9), for_each_set_clump8(9)
go read them all, iykyk π§ββοΈ honestly iconic of them to all live together like that.
lowkey a reminder: if you ever need the set bits instead of the clear ones, that's a whole different macro (for_each_set_bitrange), so don't mix them up bestie π
okay that's the page!! mwah π«Ά this dropped in ./include/linux, in the October 2026 era, and yes β this page is literally called for_each_clear_bitrange(9). slay, bye ππ
π¦ 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