mirror of
https://github.com/zoriya/Gamacon.git
synced 2026-05-31 10:36:14 +00:00
Adding my_overflow utilities
This commit is contained in:
+5
-7
@@ -28,12 +28,10 @@ void *my_realloc(void *oldptr, size_t oldsize, size_t newsize);
|
||||
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
||||
#define ABS(x) ((x) > 0 ? (x) : -(x))
|
||||
|
||||
#define CLAMP(x, y) (((x) > (y)) ? ((x) = (y)) : (x))
|
||||
#define NCLAMP(x, y) (((x) < (y)) ? ((x) = (y)) : (x))
|
||||
#define ABSCLAMP(x, y) (((x) > 0) ? CLAMP((x), (y)) : NCLAMP((x), -(y)))
|
||||
#define CLAMP(x, min, max) \
|
||||
((((x) > (max) ? (max) : (x)) < (min)) ? (min) : ((x) > (max) ? (max) : (x)))
|
||||
|
||||
#define SIGN(x) (((x) < 0) ? (-1) : ((x == 0 ? 0 : 1)))
|
||||
#define SET_SIGN(x, s) (x = (x) * (s) > 0 ? (x) : ((x) * (-1)))
|
||||
|
||||
#define ABS(x) ((x) > 0 ? (x) : -(x))
|
||||
#define MY_OVERFLOW(x, value) (x = ((x) > (value) ? -(value) : (x)))
|
||||
#define MY_UNDERFLOW(x, value) (x = ((x) < (value) ? -(value) : (x)))
|
||||
|
||||
Reference in New Issue
Block a user