find_first_and_and_bit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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: that size return value is the "nothing found" signal β€” she doesn't return -1 or throw a tantrum, she just hands you size back. 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:

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