summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Moulder <peter.moulder@monash.edu>2009-07-13 03:18:56 +0000
committerpjrm <pjrm@users.sourceforge.net>2009-07-13 03:18:56 +0000
commit235995e26f9c431091c1a1a7f1fc47d0835fd8c5 (patch)
treec9de17a23738a58a2a22afa9ee4722db3b7c1bb8
parentdoc: add TODO comment for handling hrefs better. (diff)
downloadinkscape-235995e26f9c431091c1a1a7f1fc47d0835fd8c5.tar.gz
inkscape-235995e26f9c431091c1a1a7f1fc47d0835fd8c5.zip
libnr/nr-macros.h: Change our CLAMP macro definition to provide both CLAMP and NR_CLAMP, and make it take precedence over any existing CLAMP macro (such as the one from Glib, which doesn't behave the way we want for NaN).
(bzr r8272)
-rw-r--r--src/libnr/nr-macros.h7
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))