From 4924abaad66acc966158b67f4843e12afde75352 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 19 Nov 2011 01:10:05 +0000 Subject: replace fabs with fabsf where both input and output are floats. --- source/blender/blenkernel/intern/anim_sys.c | 8 ++++---- source/blender/blenkernel/intern/camera.c | 2 +- source/blender/blenkernel/intern/fcurve.c | 4 ++-- source/blender/blenkernel/intern/mball.c | 12 ++++++------ source/blender/blenkernel/intern/nla.c | 4 ++-- source/blender/blenkernel/intern/object.c | 2 +- source/blender/blenlib/intern/math_geom.c | 12 ++++++------ source/blender/blenlib/intern/math_rotation.c | 4 ++-- source/blender/editors/interface/view2d_ops.c | 4 ++-- source/blender/python/generic/noise_py_api.c | 18 +++++++++--------- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 63ab74fc105..b32421a6b3d 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1373,17 +1373,17 @@ void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap, static float nlastrip_get_influence (NlaStrip *strip, float cframe) { /* sanity checks - normalise the blendin/out values? */ - strip->blendin= (float)fabs(strip->blendin); - strip->blendout= (float)fabs(strip->blendout); + strip->blendin= fabsf(strip->blendin); + strip->blendout= fabsf(strip->blendout); /* result depends on where frame is in respect to blendin/out values */ if (IS_EQ(strip->blendin, 0)==0 && (cframe <= (strip->start + strip->blendin))) { /* there is some blend-in */ - return (float)fabs(cframe - strip->start) / (strip->blendin); + return fabsf(cframe - strip->start) / (strip->blendin); } else if (IS_EQ(strip->blendout, 0)==0 && (cframe >= (strip->end - strip->blendout))) { /* there is some blend-out */ - return (float)fabs(strip->end - cframe) / (strip->blendout); + return fabsf(strip->end - cframe) / (strip->blendout); } else { /* in the middle of the strip, we should be full strength */ diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index a8b1c2aa04f..b0c91e76b8c 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -158,7 +158,7 @@ float object_camera_dof_distance(Object *ob) normalize_m4(obmat); invert_m4_m4(imat, obmat); mul_m4_m4m4(mat, cam->dof_ob->obmat, imat); - return (float)fabs(mat[3][2]); + return fabsf(mat[3][2]); } return cam->YF_dofdist; } diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 4bb9dc47fda..d01e3de0796 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1707,8 +1707,8 @@ void correct_bezpart (float *v1, float *v2, float *v3, float *v4) * - len2 = length of handle of end key */ len= v4[0]- v1[0]; - len1= (float)fabs(h1[0]); - len2= (float)fabs(h2[0]); + len1= fabsf(h1[0]); + len2= fabsf(h2[0]); /* if the handles have no length, no need to do any corrections */ if ((len1+len2) == 0.0f) diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index d8628e526ef..3e3f16dcfa3 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -1781,11 +1781,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */ calc_mballco(mainb[a], vec); - size= (float)fabs( vec[0] ); + size= fabsf( vec[0] ); if( size > totsize ) totsize= size; - size= (float)fabs( vec[1] ); + size= fabsf( vec[1] ); if( size > totsize ) totsize= size; - size= (float)fabs( vec[2] ); + size= fabsf( vec[2] ); if( size > totsize ) totsize= size; vec[0]= mainb[a]->x - mainb[a]->rad; @@ -1794,11 +1794,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */ calc_mballco(mainb[a], vec); - size= (float)fabs( vec[0] ); + size= fabsf( vec[0] ); if( size > totsize ) totsize= size; - size= (float)fabs( vec[1] ); + size= fabsf( vec[1] ); if( size > totsize ) totsize= size; - size= (float)fabs( vec[2] ); + size= fabsf( vec[2] ); if( size > totsize ) totsize= size; } diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 8a908097862..fd184b9def4 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -400,7 +400,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short /* scaling */ if (IS_EQF(strip->scale, 0.0f)) strip->scale= 1.0f; - scale = (float)fabs(strip->scale); /* scale must be positive - we've got a special flag for reversing */ + scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */ /* length of referenced action */ actlength = strip->actend - strip->actstart; @@ -1087,7 +1087,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip) short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max) { const float stripLen= (strip) ? strip->end - strip->start : 0.0f; - const float boundsLen= (float)fabs(max - min); + const float boundsLen= fabsf(max - min); /* sanity checks */ if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f)) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index dedf2675ff6..3c0a82667a8 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1901,7 +1901,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[ int a; // include framerate - fac1= ( 1.0f / (1.0f + (float)fabs(ob->sf)) ); + fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) ); if(fac1 >= 1.0f) return 0; fac2= 1.0f-fac1; diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 6fc3891d1bd..1170e44b27b 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -134,9 +134,9 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3]) int a, px=0, py=1; /* first: find dominant axis: 0==X, 1==Y, 2==Z */ - x= (float)fabs(normal[0]); - y= (float)fabs(normal[1]); - z= (float)fabs(normal[2]); + x= fabsf(normal[0]); + y= fabsf(normal[1]); + z= fabsf(normal[2]); max = MAX3(x, y, z); if(max==y) py=2; else if(max==x) { @@ -1689,9 +1689,9 @@ static int barycentric_weights(const float v1[3], const float v2[3], const float /* find best projection of face XY, XZ or YZ: barycentric weights of the 2d projected coords are the same and faster to compute */ - xn= (float)fabs(n[0]); - yn= (float)fabs(n[1]); - zn= (float)fabs(n[2]); + xn= fabsf(n[0]); + yn= fabsf(n[1]); + zn= fabsf(n[2]); if(zn>=xn && zn>=yn) {i= 0; j= 1;} else if(yn>=xn && yn>=zn) {i= 0; j= 2;} else {i= 1; j= 2;} diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 1637cd16161..e4664798f5d 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1322,8 +1322,8 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order,float ma compatible_eul(eul1, oldrot); compatible_eul(eul2, oldrot); - d1= (float)fabs(eul1[0]-oldrot[0]) + (float)fabs(eul1[1]-oldrot[1]) + (float)fabs(eul1[2]-oldrot[2]); - d2= (float)fabs(eul2[0]-oldrot[0]) + (float)fabs(eul2[1]-oldrot[1]) + (float)fabs(eul2[2]-oldrot[2]); + d1= fabsf(eul1[0]-oldrot[0]) + fabsf(eul1[1]-oldrot[1]) + fabsf(eul1[2]-oldrot[2]); + d2= fabsf(eul2[0]-oldrot[0]) + fabsf(eul2[1]-oldrot[1]) + fabsf(eul2[2]-oldrot[2]); /* return best, which is just the one with lowest difference */ if (d1 > d2) diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 998e70d5e25..5706da93fe9 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -985,12 +985,12 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) /* x-axis transform */ dist = (v2d->mask.xmax - v2d->mask.xmin) / 2.0f; - dx= 1.0f - ((float)fabs(vzd->lastx - dist) + 2.0f) / ((float)fabs(event->x - dist) + 2.0f); + dx= 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f); dx*= 0.5f * (v2d->cur.xmax - v2d->cur.xmin); /* y-axis transform */ dist = (v2d->mask.ymax - v2d->mask.ymin) / 2.0f; - dy= 1.0f - ((float)fabs(vzd->lasty - dist) + 2.0f) / ((float)fabs(event->y - dist) + 2.0f); + dy= 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f); dy*= 0.5f * (v2d->cur.ymax - v2d->cur.ymin); } else { diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c index c84aab83b7e..902e64eb7c1 100644 --- a/source/blender/python/generic/noise_py_api.c +++ b/source/blender/python/generic/noise_py_api.c @@ -291,7 +291,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, amp = 1.f; out = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f); if (hard) - out = (float)fabs(out); + out = fabsf(out); for (i = 1; i < oct; i++) { amp *= ampscale; x *= freqscale; @@ -299,7 +299,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb, z *= freqscale; t = (float)(amp * (2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f)); if (hard) - t = (float)fabs(t); + t = fabsf(t); out += t; } return out; @@ -321,16 +321,16 @@ static PyObject *Noise_turbulence(PyObject *UNUSED(self), PyObject *args) /* Turbulence Vector */ static void vTurb(float x, float y, float z, int oct, int hard, int nb, - float ampscale, float freqscale, float v[3]) + float ampscale, float freqscale, float v[3]) { float amp, t[3]; int i; amp = 1.f; noise_vector(x, y, z, nb, v); if (hard) { - v[0] = (float)fabs(v[0]); - v[1] = (float)fabs(v[1]); - v[2] = (float)fabs(v[2]); + v[0] = fabsf(v[0]); + v[1] = fabsf(v[1]); + v[2] = fabsf(v[2]); } for (i = 1; i < oct; i++) { amp *= ampscale; @@ -339,9 +339,9 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb, z *= freqscale; noise_vector(x, y, z, nb, t); if (hard) { - t[0] = (float)fabs(t[0]); - t[1] = (float)fabs(t[1]); - t[2] = (float)fabs(t[2]); + t[0] = fabsf(t[0]); + t[1] = fabsf(t[1]); + t[2] = fabsf(t[2]); } v[0] += amp * t[0]; v[1] += amp * t[1]; -- cgit v1.2.3