diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 09:24:14 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 09:24:14 +0300 |
commit | 41d4a1986548e66a652221e4a68c52900474eeff (patch) | |
tree | 26acf937ea0b762977f89adcc4e74a3ec9ecee62 /source/blender/blenlib | |
parent | 108045faa01849115c54190ebed788faf36dcb56 (diff) |
ClangFormat: format '#if 0' code in source/
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_fileops.h | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_mempool.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 64 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_interp.c | 6 |
5 files changed, 44 insertions, 42 deletions
diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 7787ca4cdb5..d8daa81b58d 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -51,8 +51,8 @@ int BLI_copy(const char *path, const char *to) ATTR_NONNULL(); int BLI_rename(const char *from, const char *to) ATTR_NONNULL(); int BLI_delete(const char *path, bool dir, bool recursive) ATTR_NONNULL(); #if 0 /* Unused */ -int BLI_move(const char *path, const char *to) ATTR_NONNULL(); -int BLI_create_symlink(const char *path, const char *to) ATTR_NONNULL(); +int BLI_move(const char *path, const char *to) ATTR_NONNULL(); +int BLI_create_symlink(const char *path, const char *to) ATTR_NONNULL(); #endif /* keep in sync with the definition of struct direntry in BLI_fileops_types.h */ @@ -113,7 +113,7 @@ bool BLI_file_is_writable(const char *file) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL bool BLI_file_touch(const char *file) ATTR_NONNULL(); #if 0 /* UNUSED */ -int BLI_file_gzip(const char *from, const char *to) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +int BLI_file_gzip(const char *from, const char *to) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); #endif char *BLI_file_ungzip_to_mem(const char *from_file, int *r_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 0f65f8ecbf0..4860fa6c669 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -608,11 +608,9 @@ static void *bli_mempool_iternext(BLI_mempool_iter *iter) if (iter->curchunk == NULL) { return ret; } - if (atomic_cas_ptr( - (void **)iter->curchunk_threaded_shared, - iter->curchunk, - iter->curchunk->next) == iter->curchunk) - { + if (atomic_cas_ptr((void **)iter->curchunk_threaded_shared, + iter->curchunk, + iter->curchunk->next) == iter->curchunk) { break; } } diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 9e07b4d2836..f8a34404cc7 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -85,7 +85,7 @@ int BLI_file_gzip(const char *from, const char *to) break; } else if (readsize == 0) - break; /* done reading */ + break; /* done reading */ if (gzwrite(gzfile, buffer, readsize) <= 0) { rval = -1; /* error happened in writing */ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 7d7ff3f450f..af0a66503f2 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -828,14 +828,9 @@ void dist_squared_to_projected_aabb_precalc(struct DistProjectedAABBPrecalc *pre float projmat_trans[4][4]; transpose_m4_m4(projmat_trans, projmat); if (!isect_plane_plane_plane_v3( - projmat_trans[0], projmat_trans[1], projmat_trans[3], - precalc->ray_origin)) - { + projmat_trans[0], projmat_trans[1], projmat_trans[3], precalc->ray_origin)) { /* Orthographic projection. */ - isect_plane_plane_v3( - px, py, - precalc->ray_origin, - precalc->ray_direction); + isect_plane_plane_v3(px, py, precalc->ray_origin, precalc->ray_direction); } else { /* Perspective projection. */ @@ -1908,8 +1903,7 @@ bool isect_ray_tri_watertight_v3(const float ray_origin[3], * otherwise we won't match any of the other intersect functions here... * which would be confusing */ #if 0 - || - (sign_T > *r_lambda * xor_signmask(det, sign_mask)) + || (sign_T > *r_lambda * xor_signmask(det, sign_mask)) #endif ) { return false; @@ -1945,10 +1939,14 @@ bool isect_ray_tri_watertight_v3_simple(const float ray_origin[3], * A version of #isect_ray_tri_v3 which takes a threshold argument * so rays slightly outside the triangle to be considered as intersecting. */ -bool isect_ray_tri_threshold_v3( - const float ray_origin[3], const float ray_direction[3], - const float v0[3], const float v1[3], const float v2[3], - float *r_lambda, float r_uv[2], const float threshold) +bool isect_ray_tri_threshold_v3(const float ray_origin[3], + const float ray_direction[3], + const float v0[3], + const float v1[3], + const float v2[3], + float *r_lambda, + float r_uv[2], + const float threshold) { const float epsilon = 0.00000001f; float p[3], s[3], e1[3], e2[3], q[3]; @@ -1960,14 +1958,16 @@ bool isect_ray_tri_threshold_v3( cross_v3_v3v3(p, ray_direction, e2); a = dot_v3v3(e1, p); - if ((a > -epsilon) && (a < epsilon)) return false; + 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)) return false; + if ((*r_lambda < 0.0f)) + return false; u = f * dot_v3v3(s, p); v = f * dot_v3v3(ray_direction, q); @@ -1978,13 +1978,19 @@ bool isect_ray_tri_threshold_v3( dv = v - t; } else { - if (u < 0) du = u; - else if (u > 1) du = u - 1; - else du = 0.0f; + if (u < 0) + du = u; + else if (u > 1) + du = u - 1; + else + du = 0.0f; - if (v < 0) dv = v; - else if (v > 1) dv = v - 1; - else dv = 0.0f; + if (v < 0) + dv = v; + else if (v > 1) + dv = v - 1; + else + dv = 0.0f; } mul_v3_fl(e1, du); @@ -5212,20 +5218,20 @@ typedef union { static vFloat vec_splat_float(float val) { - return (vFloat) {val, val, val, val}; + return (vFloat){val, val, val, val}; } static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float *q2, float *q3) { vFloat vcos, rlen, vrx, vry, vrz, vsrx, vsry, vsrz, gx, gy, gz, vangle; - vUInt8 rotate = (vUInt8) {4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3}; + vUInt8 rotate = (vUInt8){4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3}; vFloatResult vresult; float result; /* compute r* */ - vrx = (vFloat) {q0[0], q1[0], q2[0], q3[0]} -vec_splat_float(p[0]); - vry = (vFloat) {q0[1], q1[1], q2[1], q3[1]} -vec_splat_float(p[1]); - vrz = (vFloat) {q0[2], q1[2], q2[2], q3[2]} -vec_splat_float(p[2]); + vrx = (vFloat){q0[0], q1[0], q2[0], q3[0]} - vec_splat_float(p[0]); + vry = (vFloat){q0[1], q1[1], q2[1], q3[1]} - vec_splat_float(p[1]); + vrz = (vFloat){q0[2], q1[2], q2[2], q3[2]} - vec_splat_float(p[2]); /* normalize r* */ rlen = vec_rsqrte(vrx * vrx + vry * vry + vrz * vrz + vec_splat_float(1e-16f)); @@ -5255,9 +5261,9 @@ static float ff_quad_form_factor(float *p, float *n, float *q0, float *q1, float vangle = vacosf(vcos); /* dot */ - vresult.v = (vec_splat_float(n[0]) * gx + - vec_splat_float(n[1]) * gy + - vec_splat_float(n[2]) * gz) * vangle; + vresult.v = (vec_splat_float(n[0]) * gx + vec_splat_float(n[1]) * gy + + vec_splat_float(n[2]) * gz) * + vangle; result = (vresult.f[0] + vresult.f[1] + vresult.f[2] + vresult.f[3]) * (0.5f / (float)M_PI); result = MAX2(result, 0.0f); diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index 6acfb538036..380603913f1 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -54,10 +54,8 @@ static float P(float k) static float P(float k) { return (float)(1.0f / 6.0f) * - (pow(MAX2(k + 2.0f, 0), 3.0f) - 4.0f * - pow(MAX2(k + 1.0f, 0), 3.0f) + 6.0f * - pow(MAX2(k, 0), 3.0f) - 4.0f * - pow(MAX2(k - 1.0f, 0), 3.0f)); + (pow(MAX2(k + 2.0f, 0), 3.0f) - 4.0f * pow(MAX2(k + 1.0f, 0), 3.0f) + + 6.0f * pow(MAX2(k, 0), 3.0f) - 4.0f * pow(MAX2(k - 1.0f, 0), 3.0f)); } #endif |