in_range(9)
β¨ 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
- 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