clamp(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ clamp(9) πŸŽ€

okay bestie, welcome to the Kernel API Manual page for clamp β€” and yes, this is exactly the kind of tiny macro that has main character energy in the kernel ✨


πŸ’– NAME πŸ’–

clamp β€” return a value clamped to a given range with typechecking


πŸ¦‹ SYNOPSIS πŸ¦‹

clamp (val , lo , hi );

🌸 ARGUMENTS 🌸

  • val β€” current value
  • lo β€” lowest allowable value
  • hi β€” highest allowable value

✨ DESCRIPTION ✨

This macro checks val/lo/hi to make sure they have compatible signedness.

lowkey that's the whole vibe check: typechecking the signedness situation before anything else gets cute πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./include/linux/minmax.h β€” and these iconic friends are all linked up:


mwah πŸ’‹ signed off from ./include/linux, dated October 2026, still serving clamp(9) realness β€” bye bestie πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from