diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/macros.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/macros.h b/include/macros.h index 6adc1e4..5be5e4a 100644 --- a/include/macros.h +++ b/include/macros.h @@ -1,8 +1,9 @@ #ifndef MLIB_MACROS_H #define MLIB_MACROS_H -#define MIN(x, y) ((x) < (y) ? (x) : (y)) -#define MAX(x, y) ((x) > (y) ? (x) : (y)) +#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x)) +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +#define MAX(x, y) ((x) > (y) ? (x) : (y)) #define lengthof(a) (sizeof(a) / sizeof(*(a))) |