diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-28 07:53:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-28 07:53:37 +0400 |
commit | 7199e2288f3df27ee2d21593da64ef4597fb86fd (patch) | |
tree | 33e69c15bb612736079510dd9fbcc055c6f06e51 /source/blender/blenkernel/intern | |
parent | e6e74381819666141a5dd02d670ef06e64018dc3 (diff) |
Code cleanup: use sqrtf when input and output are float
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/seqeffects.c | 12 |
3 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 580a8a7a505..243b99a31e4 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -2689,7 +2689,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t switch (data->volmode) { /* volume preserving scaling */ case VOLUME_XZ: - scale[0] = 1.0f - (float)sqrt(data->bulge) + (float)sqrt(data->bulge * (data->orglength / dist)); + scale[0] = 1.0f - sqrtf(data->bulge) + sqrtf(data->bulge * (data->orglength / dist)); scale[2] = scale[0]; break; case VOLUME_X: diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index bc65e5bf749..864682c5607 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1931,8 +1931,8 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si { float t01, t02, x3, y3; - t01 = (float)sqrt(x1 * x1 + y1 * y1); - t02 = (float)sqrt(x2 * x2 + y2 * y2); + t01 = sqrtf(x1 * x1 + y1 * y1); + t02 = sqrtf(x2 * x2 + y2 * y2); if (t01 == 0.0f) t01 = 1.0f; if (t02 == 0.0f) @@ -1960,7 +1960,7 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si y3 = -x1; } else { - t01 = (float)sqrt(x3 * x3 + y3 * y3); + t01 = sqrtf(x3 * x3 + y3 * y3); x3 /= t01; y3 /= t01; } diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index ab44cf720d0..9e59ec8d8d5 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -678,8 +678,10 @@ static void gamtabs(float gamma) val = a; val /= 65535.0f; - if (gamma == 2.0f) val = sqrt(val); - else if (gamma != 1.0f) val = pow(val, igamma); + if (gamma == 2.0f) + val = sqrtf(val); + else if (gamma != 1.0f) + val = powf(val, igamma); gamtab[a] = (65535.99f * val); } @@ -1443,7 +1445,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f temp1 = xo * (1 - facf0 / 2) - xo * facf0 / 2; temp2 = yo * (1 - facf0 / 2) - yo * facf0 / 2; - pointdist = sqrt(temp1 * temp1 + temp2 * temp2); + pointdist = sqrtf(temp1 * temp1 + temp2 * temp2); if (b2 < b1 && b2 < b3) { if (hwidth < pointdist) @@ -1500,9 +1502,9 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f hwidth = width * 0.5f; temp1 = (halfx - (halfx) * facf0); - pointdist = sqrt(temp1 * temp1 + temp1 * temp1); + pointdist = sqrtf(temp1 * temp1 + temp1 * temp1); - temp2 = sqrt((halfx - x) * (halfx - x) + (halfy - y) * (halfy - y)); + temp2 = sqrtf((halfx - x) * (halfx - x) + (halfy - y) * (halfy - y)); if (temp2 > pointdist) output = in_band(hwidth, fabsf(temp2 - pointdist), 0, 1); else output = in_band(hwidth, fabsf(temp2 - pointdist), 1, 1); |