diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/libnr/nr-macros.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libnr/nr-macros.h b/src/libnr/nr-macros.h index 0e0307916..37a3675e6 100644 --- a/src/libnr/nr-macros.h +++ b/src/libnr/nr-macros.h @@ -30,19 +30,20 @@ #define MIN(a,b) (((a) > (b)) ? (b) : (a)) #endif -#ifndef CLAMP /** Returns v bounded to within [a, b]. If v is NaN then returns a. * * \pre \a a \<= \a b. */ -# define CLAMP(v,a,b) \ +#define NR_CLAMP(v,a,b) \ (assert (a <= b), \ ((v) >= (a)) \ ? (((v) > (b)) \ ? (b) \ : (v)) \ : (a)) -#endif + +#undef CLAMP /* get rid of glib's version, which doesn't handle NaN correctly */ +#define CLAMP(v,a,b) NR_CLAMP(v,a,b) #define NR_DF_TEST_CLOSE(a,b,e) (fabs ((a) - (b)) <= (e)) |
