diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-11-10 18:13:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-11-10 18:13:26 +0400 |
commit | aaa99106fe3c40e2b8cf4d60e14597a976b2f983 (patch) | |
tree | b4b3db72fdfaff40278031d8621c58949f2e4d18 /source/blender/blenlib/BLI_utildefines.h | |
parent | 8cf39603f744ff10e3e517414c563d2344fd02cc (diff) |
make IS_EQ and IS_EQF typecheck args
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index c3a3c035ed3..9bf720c03ea 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -240,8 +240,13 @@ #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)) |