diff options
Diffstat (limited to 'source/blender/blenlib/intern/math_base_inline.c')
-rw-r--r-- | source/blender/blenlib/intern/math_base_inline.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index 221a27f69ed..8f30255a08b 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -230,23 +230,29 @@ MINLINE unsigned power_of_2_min_u(unsigned x) #define _round_clamp_fl_impl(arg, ty, min, max) \ { \ float r = floorf(arg + 0.5f); \ - if (UNLIKELY(r <= (float)min)) \ + if (UNLIKELY(r <= (float)min)) { \ return (ty)min; \ - else if (UNLIKELY(r >= (float)max)) \ + } \ + else if (UNLIKELY(r >= (float)max)) { \ return (ty)max; \ - else \ + } \ + else { \ return (ty)r; \ + } \ } #define _round_clamp_db_impl(arg, ty, min, max) \ { \ double r = floor(arg + 0.5); \ - if (UNLIKELY(r <= (double)min)) \ + if (UNLIKELY(r <= (double)min)) { \ return (ty)min; \ - else if (UNLIKELY(r >= (double)max)) \ + } \ + else if (UNLIKELY(r >= (double)max)) { \ return (ty)max; \ - else \ + } \ + else { \ return (ty)r; \ + } \ } #define _round_fl_impl(arg, ty) \ |