util: add a clamp macro

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1280>
This commit is contained in:
Peter Hutterer 2025-07-28 11:20:18 +10:00 committed by Marge Bot
parent e8d24f818b
commit 74705ee94c

View file

@ -43,6 +43,7 @@
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define clamp(v, lo, hi) min((hi), max((lo), (v)))
#define ANSI_BOLD "\x1B[0;1m"
#define ANSI_RED "\x1B[0;31m"