utils: Add clamp() macro

Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
This commit is contained in:
Daniel Silverstone 2024-05-27 09:35:49 +01:00
parent 37dfc4a44e
commit 8193a5518e
No known key found for this signature in database
GPG Key ID: C30DF439F2987D74

View File

@ -49,6 +49,10 @@
#ifndef max
#define max(x,y) (((x)>(y))?(x):(y))
#endif
#ifndef clamp
#define clamp(x,low,high) (min(max((x),(low)),(high)))
#endif
#endif
/* Windows does not have POSIX mkdir so work around that */