[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61224] trunk/blender/source/blender/ blenlib/BLI_utildefines.h: make IS_EQ and IS_EQF typecheck args

Campbell Barton ideasman42 at gmail.com
Sun Nov 10 15:13:26 CET 2013


Revision: 61224
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=61224
Author:   campbellbarton
Date:     2013-11-10 14:13:26 +0000 (Sun, 10 Nov 2013)
Log Message:
-----------
make IS_EQ and IS_EQF typecheck args

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_utildefines.h

Modified: trunk/blender/source/blender/blenlib/BLI_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_utildefines.h	2013-11-10 12:56:50 UTC (rev 61223)
+++ trunk/blender/source/blender/blenlib/BLI_utildefines.h	2013-11-10 14:13:26 UTC (rev 61224)
@@ -240,9 +240,14 @@
 
 #define CLAMPIS(a, b, c) ((a) < (b) ? (b) : (a) > (c) ? (c) : (a))
 
-#define IS_EQ(a, b) ((fabs((double)(a) - (b)) >= (double) FLT_EPSILON) ? 0 : 1)
-#define IS_EQF(a, b) ((fabsf((float)(a) - (b)) >= (float) FLT_EPSILON) ? 0 : 1)
+#define IS_EQ(a, b)  ( \
+	CHECK_TYPE_INLINE(a, double), CHECK_TYPE_INLINE(b, double), \
+	((fabs((double)(a) - (b)) >= (double) FLT_EPSILON) ? false : true))
 
+#define IS_EQF(a, b)  ( \
+	CHECK_TYPE_INLINE(a, float), CHECK_TYPE_INLINE(b, float), \
+	((fabsf((float)(a) - (b)) >= (float) FLT_EPSILON) ? false : true))
+
 #define IS_EQT(a, b, c) ((a > b) ? (((a - b) <= c) ? 1 : 0) : ((((b - a) <= c) ? 1 : 0)))
 #define IN_RANGE(a, b, c) ((b < c) ? ((b < a && a < c) ? 1 : 0) : ((c < a && a < b) ? 1 : 0))
 #define IN_RANGE_INCL(a, b, c) ((b < c) ? ((b <= a && a <= c) ? 1 : 0) : ((c <= a && a <= b) ? 1 : 0))




More information about the Bf-blender-cvs mailing list