in_range(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

okay so bestie, welcome to in_range from the Kernel API Manual β€” this page is literally about determining if a value lies within a range. πŸ’…


🌸 SYNOPSIS 🌸

in_range (val , start , len );

πŸŽ€ ARGUMENTS πŸŽ€

  • val β€” the value you’re testing. πŸ‘€
  • start β€” the first value in the range.
  • len β€” how many values are in the range.

πŸ’– DESCRIPTION πŸ’–

This is more efficient than "if (start <= val && val < (start + len))". No cap. ✨

It also gives a different answer if start + len overflows the size of the type by a sufficient amount to encompass val. So yeah, decide for yourself which behavior you want, or prove that start + len never overflows. 🫢

Do not blindly replace one form with the other. fr fr, that’s the whole warning. 😭

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/linux/minmax.h: min(9), max(9), umin(9), umax(9), min3(9), max3(9), min_t(9), max_t(9), min_not_zero(9), clamp(9), clamp_t(9), clamp_val(9), min_array(9), max_array(9), swap(9).


made with πŸ’– from ./include/linux Β· October 2026 Β· in_range(9) πŸ‘‘

πŸ“¦ where this page comes from