find_first_and_and_bit(9)
π find_first_and_and_bit(9)
okay so this is from the kernel API manual, section 9 β and bestie, the name literally says it all: find_first_and_and_bit. yes, "and and". no, that's not a typo, that's the whole bitwise vibe. two ands because we're checking three regions at once. iconic behavior honestly π
β¨ NAME β¨
find_first_and_and_bit β find the first set bit in 3 memory regions π¦
like, three whole bitmaps. at the same time. she's doing the most and we love her for it π
πΈ SYNOPSIS πΈ
unsigned long find_first_and_and_bit (const unsigned long *addr1 , const
unsigned long *addr2 , const unsigned long *addr3 , unsigned long size
);
yes the signature is a little long, she's got a lot going on, don't judge π
π ARGUMENTS π
addr1β the first address to base the search on. your starting point, your main character πaddr2β the second address to base the search on. the plus-one, the ride-or-die π«Άaddr3β the third address to base the search on. yes there's a third one, it's giving trio energy πsizeβ the bitmap size in bits. so like, how far we're allowed to look π₯
β DESCRIPTION β
returns the bit number for the first set bit. simple as that, no cap π
if no bits are set, returns size. like okay, didn't find anything, here's the boundary back, thanks for asking π
lowkey important: thatsizereturn value is the "nothing found" signal β she doesn't return-1or throw a tantrum, she just hands yousizeback. so like, check for it, bestie π
π¦ SEE ALSO π¦
the whole friend group lives in the kernel file ./include/linux/find.h, and honestly it's a full group chat:
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_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(9)for_each_clear_bitrange_from(9)for_each_set_bit_wrap(9)for_each_set_clump8(9)
like, every single one of them. the whole squad. go say hi π§
anyway that's the page! sourced from ./include/linux, dated October 2026. mwah, go find those bits bestie πβ¨π
π¦ 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