array_index_mask_nospec(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… array_index_mask_nospec(9) πŸ’…

okay so bestie, this is from the Kernel API Manual, and honestly? array_index_mask_nospec(9) is a whole vibe. No cap. 🫢

πŸŽ€ NAME πŸŽ€

array_index_mask_nospec β€” generate a ~0 mask when index < size, 0 otherwise. That's it, that's the function. Slay. ✨

🌸 SYNOPSIS 🌸

unsigned long array_index_mask_nospec (unsigned long index , unsigned long size );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • index β€” the array element index, bestie. Like, which element you're looking at. πŸ‘€
  • size β€” the number of elements in the array. The whole roster, periodt. πŸ’…

πŸ”₯ DESCRIPTION πŸ”₯

okay so lowkey the whole point is this: when index is out of bounds (index >= size), the sign bit will be set. Then you extend the sign bit to all bits and invert it β€” giving a result of zero for an out of bounds index, or ~0 if within bounds [0, size). That's the whole mask moment. Iconic. πŸ’–

πŸ” SEE ALSO πŸ”

  • Kernel file ./include/linux/nospec.h β€” go read it, iykyk 🧚

xoxo, your girl from ./include/linux β€” October 2026 edition. Later, bestie! 🫢✨

πŸ“¦ where this page comes from