summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 50459c2)
raw | patch | inline | side by side (parent: 50459c2)
author | pjrm <pjrm@users.sourceforge.net> | |
Mon, 13 Jul 2009 03:18:56 +0000 (03:18 +0000) | ||
committer | pjrm <pjrm@users.sourceforge.net> | |
Mon, 13 Jul 2009 03:18:56 +0000 (03:18 +0000) |
src/libnr/nr-macros.h | patch | blob | history |
diff --git a/src/libnr/nr-macros.h b/src/libnr/nr-macros.h
index 0e0307916faa87b6be5ed6ca392b0d27d5ac1c4c..37a3675e621b9596197ce9f64c70b136b835013a 100644 (file)
--- a/src/libnr/nr-macros.h
+++ b/src/libnr/nr-macros.h
#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))