From aba4e6810f8b4d0e459137b64e061a2cadc457d1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 31 May 2019 23:21:16 +1000 Subject: Cleanup: style, use braces in source/ (include disabled blocks) --- source/blender/blenlib/intern/math_base_inline.c | 18 ++++++++++++------ source/blender/blenlib/intern/math_geom.c | 24 ++++++++++++++++-------- source/blender/blenlib/intern/smallhash.c | 3 ++- 3 files changed, 30 insertions(+), 15 deletions(-) (limited to 'source/blender/blenlib') 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) \ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 898e97613c1..99eee0aa51c 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -1959,16 +1959,18 @@ bool isect_ray_tri_threshold_v3(const float ray_origin[3], cross_v3_v3v3(p, ray_direction, e2); a = dot_v3v3(e1, p); - if ((a > -epsilon) && (a < epsilon)) + if ((a > -epsilon) && (a < epsilon)) { return false; + } f = 1.0f / a; sub_v3_v3v3(s, ray_origin, v0); cross_v3_v3v3(q, s, e1); *r_lambda = f * dot_v3v3(e2, q); - if ((*r_lambda < 0.0f)) + if ((*r_lambda < 0.0f)) { return false; + } u = f * dot_v3v3(s, p); v = f * dot_v3v3(ray_direction, q); @@ -1979,19 +1981,25 @@ bool isect_ray_tri_threshold_v3(const float ray_origin[3], dv = v - t; } else { - if (u < 0) + if (u < 0) { du = u; - else if (u > 1) + } + else if (u > 1) { du = u - 1; - else + } + else { du = 0.0f; + } - if (v < 0) + if (v < 0) { dv = v; - else if (v > 1) + } + else if (v > 1) { dv = v - 1; - else + } + else { dv = 0.0f; + } } mul_v3_fl(e1, du); diff --git a/source/blender/blenlib/intern/smallhash.c b/source/blender/blenlib/intern/smallhash.c index ea15c14d3d2..d5fdf003aef 100644 --- a/source/blender/blenlib/intern/smallhash.c +++ b/source/blender/blenlib/intern/smallhash.c @@ -372,8 +372,9 @@ void BLI_smallhash_print(SmallHash *sh) printf("%2x", (uint)sh->buckets[i].key); } - if (i != sh->nbuckets - 1) + if (i != sh->nbuckets - 1) { printf(", "); + } c += 6; -- cgit v1.2.3