diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/macros.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/macros.h b/src/util/macros.h index a10f1de8145..a66f1bfed07 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -244,8 +244,8 @@ do { \ /** Compute ceiling of integer quotient of A divided by B. */ #define DIV_ROUND_UP( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 ) -/** Clamp X to [MIN,MAX] */ -#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) +/** Clamp X to [MIN,MAX]. Turn NaN into MIN, arbitrarily. */ +#define CLAMP( X, MIN, MAX ) ( (X)>(MIN) ? ((X)>(MAX) ? (MAX) : (X)) : (MIN) ) /** Minimum of two values: */ #define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) |