summaryrefslogtreecommitdiff
path: root/src/util/macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/macros.h')
-rw-r--r--src/util/macros.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util/macros.h b/src/util/macros.h
index a10f1de814..a66f1bfed0 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) )