From 7cb20d841da16d0bffb63154403267500e9941f5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 6 Nov 2020 11:25:27 +1100 Subject: Cleanup: follow our code style for float literals --- source/blender/blenlib/intern/math_base_inline.c | 2 +- source/blender/blenlib/intern/math_geom.c | 2 +- source/blender/blenlib/intern/math_interp.c | 6 ++-- source/blender/blenlib/intern/math_matrix.c | 2 +- source/blender/blenlib/intern/noise.c | 10 +++--- source/blender/blenlib/intern/voxel.c | 44 ++++++++++++------------ 6 files changed, 33 insertions(+), 33 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 1b388dcf11f..8cc5c31a4c7 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -611,7 +611,7 @@ MINLINE int compare_ff_relative(float a, float b, const float max_diff, const in MINLINE float signf(float f) { - return (f < 0.f) ? -1.f : 1.f; + return (f < 0.0f) ? -1.0f : 1.0f; } MINLINE float compatible_signf(float f) diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index dcdc7c4d668..c834108a0de 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -5497,7 +5497,7 @@ void vcloud_estimate_transform_v3(const int list_size, stunt[1] = q[1][1]; stunt[2] = q[2][2]; /* renormalizing for numeric stability */ - mul_m3_fl(q, 1.f / len_v3(stunt)); + mul_m3_fl(q, 1.0f / len_v3(stunt)); /* this is pretty much Polardecompose 'inline' the algo based on Higham's thesis */ /* without the far case ... but seems to work here pretty neat */ diff --git a/source/blender/blenlib/intern/math_interp.c b/source/blender/blenlib/intern/math_interp.c index 13a1816f1bd..3cec3db9806 100644 --- a/source/blender/blenlib/intern/math_interp.c +++ b/source/blender/blenlib/intern/math_interp.c @@ -517,7 +517,7 @@ void BLI_bilinear_interpolation_wrap_char(const unsigned char *buffer, * otherwise at high texture magnifications circular artifacts are visible. */ #define EWA_MAXIDX 255 const float EWA_WTS[EWA_MAXIDX + 1] = { - 1.f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, + 1.0f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, 0.938216f, 0.929664f, 0.921178f, 0.912759f, 0.904405f, 0.896117f, 0.887893f, 0.879734f, 0.871638f, 0.863605f, 0.855636f, 0.847728f, 0.839883f, 0.832098f, 0.824375f, 0.816712f, 0.809108f, 0.801564f, 0.794079f, 0.786653f, 0.779284f, @@ -553,7 +553,7 @@ const float EWA_WTS[EWA_MAXIDX + 1] = { 0.0324175f, 0.0309415f, 0.029477f, 0.0280239f, 0.0265822f, 0.0251517f, 0.0237324f, 0.0223242f, 0.020927f, 0.0195408f, 0.0181653f, 0.0168006f, 0.0154466f, 0.0141031f, 0.0127701f, 0.0114476f, 0.0101354f, 0.00883339f, 0.00754159f, 0.00625989f, 0.00498819f, - 0.00372644f, 0.00247454f, 0.00123242f, 0.f, + 0.00372644f, 0.00247454f, 0.00123242f, 0.0f, }; static void radangle2imp(float a2, float b2, float th, float *A, float *B, float *C, float *F) @@ -625,7 +625,7 @@ void BLI_ewa_filter(const int width, * Use a different radius based on interpolation switch, * just enough to anti-alias when interpolation is off, * and slightly larger to make result a bit smoother than bilinear interpolation when - * interpolation is on (minimum values: const float rmin = intpol ? 1.f : 0.5f;) */ + * interpolation is on (minimum values: const float rmin = intpol ? 1.0f : 0.5f;) */ const float rmin = (intpol ? 1.5625f : 0.765625f) / ff2; BLI_ewa_imp2radangle(A, B, C, F, &a, &b, &th, &ecc); if ((b2 = b * b) < rmin) { diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 9769d2baf9b..1de69499c8d 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -2920,7 +2920,7 @@ void svd_m4(float U[4][4], float s[4], float V[4][4], float A_[4][4]) if (ks == k) { break; } - t = (ks != p ? fabsf(e[ks]) : 0.f) + (ks != k + 1 ? fabsf(e[ks - 1]) : 0.0f); + t = (ks != p ? fabsf(e[ks]) : 0.0f) + (ks != k + 1 ? fabsf(e[ks - 1]) : 0.0f); if (fabsf(s[ks]) <= eps * t) { s[ks] = 0.0f; break; diff --git a/source/blender/blenlib/intern/noise.c b/source/blender/blenlib/intern/noise.c index bc8135605a8..cca08feee0d 100644 --- a/source/blender/blenlib/intern/noise.c +++ b/source/blender/blenlib/intern/noise.c @@ -1051,8 +1051,8 @@ static float voronoi_F1F2(float x, float y, float z) static float voronoi_Cr(float x, float y, float z) { float t = 10 * voronoi_F1F2(x, y, z); - if (t > 1.f) { - return 1.f; + if (t > 1.0f) { + return 1.0f; } return t; } @@ -1099,8 +1099,8 @@ static float voronoi_F1F2S(float x, float y, float z) static float voronoi_CrS(float x, float y, float z) { float t = 10 * voronoi_F1F2(x, y, z); - if (t > 1.f) { - return 1.f; + if (t > 1.0f) { + return 1.0f; } return (2.0f * t - 1.0f); } @@ -1572,7 +1572,7 @@ float BLI_noise_mg_hybrid_multi_fractal(float x, } float rmd = octaves - floorf(octaves); - if (rmd != 0.f) { + if (rmd != 0.0f) { result += rmd * ((noisefunc(x, y, z) + offset) * pwr); } diff --git a/source/blender/blenlib/intern/voxel.c b/source/blender/blenlib/intern/voxel.c index 2c8eb9f5a13..eac01a0e2aa 100644 --- a/source/blender/blenlib/intern/voxel.c +++ b/source/blender/blenlib/intern/voxel.c @@ -51,7 +51,7 @@ float BLI_voxel_sample_nearest(const float *data, const int res[3], const float BLI_INLINE int FLOORI(float x) { const int r = (int)x; - return ((x >= 0.f) || (float)r == x) ? r : (r - 1); + return ((x >= 0.0f) || (float)r == x) ? r : (r - 1); } /* clamp function, cannot use the CLAMPIS macro, @@ -92,9 +92,9 @@ float BLI_voxel_sample_trilinear(const float *data, const int res[3], const floa const float dy = yf - (float)y; const float dz = zf - (float)z; - const float u[2] = {1.f - dx, dx}; - const float v[2] = {1.f - dy, dy}; - const float w[2] = {1.f - dz, dz}; + const float u[2] = {1.0f - dx, dx}; + const float v[2] = {1.0f - dy, dy}; + const float w[2] = {1.0f - dz, dz}; return w[0] * (v[0] * (u[0] * data[xc[0] + yc[0] + zc[0]] + u[1] * data[xc[1] + yc[0] + zc[0]]) + @@ -103,7 +103,7 @@ float BLI_voxel_sample_trilinear(const float *data, const int res[3], const floa (v[0] * (u[0] * data[xc[0] + yc[0] + zc[1]] + u[1] * data[xc[1] + yc[0] + zc[1]]) + v[1] * (u[0] * data[xc[0] + yc[1] + zc[1]] + u[1] * data[xc[1] + yc[1] + zc[1]])); } - return 0.f; + return 0.0f; } float BLI_voxel_sample_triquadratic(const float *data, const int res[3], const float co[3]) @@ -132,9 +132,9 @@ float BLI_voxel_sample_triquadratic(const float *data, const int res[3], const f }; const float dx = xf - (float)x, dy = yf - (float)y, dz = zf - (float)z; - const float u[3] = {dx * (0.5f * dx - 1.f) + 0.5f, dx * (1.0f - dx) + 0.5f, 0.5f * dx * dx}; - const float v[3] = {dy * (0.5f * dy - 1.f) + 0.5f, dy * (1.0f - dy) + 0.5f, 0.5f * dy * dy}; - const float w[3] = {dz * (0.5f * dz - 1.f) + 0.5f, dz * (1.0f - dz) + 0.5f, 0.5f * dz * dz}; + const float u[3] = {dx * (0.5f * dx - 1.0f) + 0.5f, dx * (1.0f - dx) + 0.5f, 0.5f * dx * dx}; + const float v[3] = {dy * (0.5f * dy - 1.0f) + 0.5f, dy * (1.0f - dy) + 0.5f, 0.5f * dy * dy}; + const float w[3] = {dz * (0.5f * dz - 1.0f) + 0.5f, dz * (1.0f - dz) + 0.5f, 0.5f * dz * dz}; return w[0] * (v[0] * (u[0] * data[xc[0] + yc[0] + zc[0]] + u[1] * data[xc[1] + yc[0] + zc[0]] + @@ -158,7 +158,7 @@ float BLI_voxel_sample_triquadratic(const float *data, const int res[3], const f v[2] * (u[0] * data[xc[0] + yc[2] + zc[2]] + u[1] * data[xc[1] + yc[2] + zc[2]] + u[2] * data[xc[2] + yc[2] + zc[2]])); } - return 0.f; + return 0.0f; } float BLI_voxel_sample_tricubic(const float *data, @@ -195,18 +195,18 @@ float BLI_voxel_sample_tricubic(const float *data, float u[4], v[4], w[4]; if (bspline) { // B-Spline - u[0] = (((-1.f / 6.f) * dx + 0.5f) * dx - 0.5f) * dx + (1.f / 6.f); - u[1] = ((0.5f * dx - 1.f) * dx) * dx + (2.f / 3.f); - u[2] = ((-0.5f * dx + 0.5f) * dx + 0.5f) * dx + (1.f / 6.f); - u[3] = (1.f / 6.f) * dx * dx * dx; - v[0] = (((-1.f / 6.f) * dy + 0.5f) * dy - 0.5f) * dy + (1.f / 6.f); - v[1] = ((0.5f * dy - 1.f) * dy) * dy + (2.f / 3.f); - v[2] = ((-0.5f * dy + 0.5f) * dy + 0.5f) * dy + (1.f / 6.f); - v[3] = (1.f / 6.f) * dy * dy * dy; - w[0] = (((-1.f / 6.f) * dz + 0.5f) * dz - 0.5f) * dz + (1.f / 6.f); - w[1] = ((0.5f * dz - 1.f) * dz) * dz + (2.f / 3.f); - w[2] = ((-0.5f * dz + 0.5f) * dz + 0.5f) * dz + (1.f / 6.f); - w[3] = (1.f / 6.f) * dz * dz * dz; + u[0] = (((-1.0f / 6.0f) * dx + 0.5f) * dx - 0.5f) * dx + (1.0f / 6.0f); + u[1] = ((0.5f * dx - 1.0f) * dx) * dx + (2.0f / 3.0f); + u[2] = ((-0.5f * dx + 0.5f) * dx + 0.5f) * dx + (1.0f / 6.0f); + u[3] = (1.0f / 6.0f) * dx * dx * dx; + v[0] = (((-1.0f / 6.0f) * dy + 0.5f) * dy - 0.5f) * dy + (1.0f / 6.0f); + v[1] = ((0.5f * dy - 1.0f) * dy) * dy + (2.0f / 3.0f); + v[2] = ((-0.5f * dy + 0.5f) * dy + 0.5f) * dy + (1.0f / 6.0f); + v[3] = (1.0f / 6.0f) * dy * dy * dy; + w[0] = (((-1.0f / 6.0f) * dz + 0.5f) * dz - 0.5f) * dz + (1.0f / 6.0f); + w[1] = ((0.5f * dz - 1.0f) * dz) * dz + (2.0f / 3.0f); + w[2] = ((-0.5f * dz + 0.5f) * dz + 0.5f) * dz + (1.0f / 6.0f); + w[3] = (1.0f / 6.0f) * dz * dz * dz; } else { // Catmull-Rom u[0] = ((-0.5f * dx + 1.0f) * dx - 0.5f) * dx; @@ -260,5 +260,5 @@ float BLI_voxel_sample_tricubic(const float *data, v[3] * (u[0] * data[xc[0] + yc[3] + zc[3]] + u[1] * data[xc[1] + yc[3] + zc[3]] + u[2] * data[xc[2] + yc[3] + zc[3]] + u[3] * data[xc[3] + yc[3] + zc[3]])); } - return 0.f; + return 0.0f; } -- cgit v1.2.3