plastimatch
Loading...
Searching...
No Matches
clamp.h File Reference

Go to the source code of this file.

Macros

#define CLAMP(value, min_value, max_value)
 
#define CLAMP2(v1, v2, min_value, max_value)
 

Macro Definition Documentation

◆ CLAMP

#define CLAMP ( value,
min_value,
max_value )
Value:
do { \
if (value < min_value) { \
value = min_value; \
} else if (value > max_value) { \
value = max_value; \
} \
} while (0)

◆ CLAMP2

#define CLAMP2 ( v1,
v2,
min_value,
max_value )
Value:
do { \
if (v1 < min_value) { \
v1 = min_value; \
} \
if (v2 > max_value) { \
v2 = max_value; \
} \
if (v2 < v1) { \
v2 = v1; \
} \
} while (0)