GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
Fast value clamping. More...
#include <core/gp_compiler.h>
Go to the source code of this file.
Macros | |
#define | GP_CLAMP(val, min, max) |
Clamps a value. | |
#define | GP_CLAMP_DOWN(val, max) |
Clamps down a value. | |
#define | GP_SAT_ADD(val, add, max) |
Saturated addition. | |
Fast value clamping.
Definition in file gp_clamp.h.
#define GP_CLAMP | ( | val, | |
min, | |||
max | |||
) |
Clamps a value.
The resulting value will fit into [min, max] interval.
val | A value to be clamped. |
min | A lower limit. |
max | An upper limit. |
Definition at line 41 of file gp_clamp.h.
#define GP_CLAMP_DOWN | ( | val, | |
max | |||
) |
Clamps down a value.
val | A value to be clamped. |
max | An uppper limit. |
Definition at line 56 of file gp_clamp.h.
#define GP_SAT_ADD | ( | val, | |
add, | |||
max | |||
) |
Saturated addition.
The resulting value will fit into the [0, max] interval.
val | A positive value to add to. |
add | A value to be added may be negative. |
max | An upper limit for the addition. |
Definition at line 73 of file gp_clamp.h.