Macro definitions for MIN, MAX, and CLAMP.
More...
Go to the source code of this file.
|
#define | MAX(a, b) ( ((a)<(b)) ? (b) : (a) ) |
|
#define | MIN(a, b) ( ((a)>(b)) ? (b) : (a) ) |
|
#define | CLAMP(min, v, max) |
|
#define | ABS(x) ( ((x)<0) ? -(x) : (x) ) |
|
Macro definitions for MIN, MAX, and CLAMP.
Definition in file cmp.h.
◆ ABS
#define ABS |
( |
|
x | ) |
( ((x)<0) ? -(x) : (x) ) |
Give the absolute value of x, independent of its type.
Definition at line 40 of file cmp.h.
◆ CLAMP
#define CLAMP |
( |
|
min, |
|
|
|
v, |
|
|
|
max |
|
) |
| |
Value: ( ((v) < (min)) ? (min) : \
((v) > (max)) ? (max) : \
(v) )
Definition at line 34 of file cmp.h.
◆ MAX
#define MAX |
( |
|
a, |
|
|
|
b |
|
) |
| ( ((a)<(b)) ? (b) : (a) ) |
Macros for MIN/MAX. Never use these when the arguments could have side-effects. {With GCC extensions we could probably define a safer MIN/MAX. But depending on that safety would be dangerous, since not every platform has it.}
Definition at line 22 of file cmp.h.
◆ MIN
#define MIN |
( |
|
a, |
|
|
|
b |
|
) |
| ( ((a)>(b)) ? (b) : (a) ) |
Definition at line 25 of file cmp.h.