From 3a99fa5d7fa11a047bc873d0ef1825a8f389c88d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 28 Feb 2014 11:47:02 +1100 Subject: Revert own changes to CLAMP and CLAMPIS, caused T38875 --- source/blender/blenlib/BLI_utildefines.h | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index ef2c61cc45a..9f6eabf3a66 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -256,27 +256,19 @@ /* some misc stuff.... */ -/* avoid multiple access & type conversions for supported compilers */ +/* avoid multiple access for supported compilers */ #if defined(__GNUC__) || defined(__clang__) #define ABS(a) ({ \ typeof(a) a_ = (a); \ ((a_) < 0 ? (-(a_)) : (a_)); }) -#define CLAMPIS(a, b, c) ({ \ - typeof(a) a_ = (a), b_ = (b), c_ = (c); \ - ((a_) < (b_) ? (b_) : (a_) > (c_) ? (c_) : (a_)); }) - -#define CLAMP(a, b, c) { \ - typeof(a) b_ = (b), c_ = (c); \ - if ((a) < (b_)) (a) = (b_); \ - else if ((a) > (c_)) (a) = (c_); \ -} (void)0 - #else #define ABS(a) ((a) < 0 ? (-(a)) : (a)) +#endif + #define CLAMPIS(a, b, c) ((a) < (b) ? (b) : (a) > (c) ? (c) : (a)) #define CLAMP(a, b, c) { \ @@ -284,8 +276,6 @@ else if ((a) > (c)) (a) = (c); \ } (void)0 -#endif - #define IS_EQ(a, b) ( \ CHECK_TYPE_INLINE(a, double), CHECK_TYPE_INLINE(b, double), \ -- cgit v1.2.3