Code Cleanup: replace ABS() with fabsf() when used with float expressions.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 1 Dec 2013 02:11:12 +0000 (13:11 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 1 Dec 2013 02:11:12 +0000 (13:11 +1100)
source/blender/blenkernel/intern/implicit.c
source/blender/blenkernel/intern/mesh.c
source/blender/editors/animation/anim_markers.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/screen/glutil.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/transform/transform_snap.c

index c8e18bc3dee47d37860ca9902523f86a3a02ab8d..fce6ed9d6c6111a11a6eaead880626242cfdd656 100644 (file)
@@ -1265,7 +1265,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
                        
                        k = clmd->sim_parms->structural;
 
-                       scaling = k + s->stiffness * ABS(clmd->sim_parms->max_struct-k);
+                       scaling = k + s->stiffness * fabsf(clmd->sim_parms->max_struct - k);
 
                        k = scaling / (clmd->sim_parms->avg_spring_len + FLT_EPSILON);
 
@@ -1305,7 +1305,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
                
                k = clmd->sim_parms->goalspring;
                
-               scaling = k + s->stiffness * ABS(clmd->sim_parms->max_struct-k);
+               scaling = k + s->stiffness * fabsf(clmd->sim_parms->max_struct - k);
                        
                k = verts [s->ij].goal * scaling / (clmd->sim_parms->avg_spring_len + FLT_EPSILON);
                
@@ -1324,7 +1324,7 @@ DO_INLINE void cloth_calc_spring_force(ClothModifierData *clmd, ClothSpring *s,
                        
                        k = clmd->sim_parms->bending;
                        
-                       scaling = k + s->stiffness * ABS(clmd->sim_parms->max_bend-k);
+                       scaling = k + s->stiffness * fabsf(clmd->sim_parms->max_bend - k);
                        cb = k = scaling / (20.0f * (clmd->sim_parms->avg_spring_len + FLT_EPSILON));
 
                        mul_fvector_S(bending_force, dir, fbstar(length, L, k, cb));
index ee25b0a72df834e36d5843f6ca7cb7c70e452397..af23a84a26b46317d468f1209611a2719cf45d05 100644 (file)
@@ -251,7 +251,7 @@ static int customdata_compare(CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2
                                for (k = 0; k < dv1->totweight; k++, dw1++, dw2++) {
                                        if (dw1->def_nr != dw2->def_nr)
                                                return MESHCMP_DVERT_GROUPMISMATCH;
-                                       if (ABS(dw1->weight - dw2->weight) > thresh)
+                                       if (fabsf(dw1->weight - dw2->weight) > thresh)
                                                return MESHCMP_DVERT_WEIGHTMISMATCH;
                                }
                        }
index 79c0c63b11951e209226ea0595c701ff6ef13208..9818c312e8e0272675a905dba28b57032fcf02f1 100644 (file)
@@ -173,7 +173,7 @@ TimeMarker *ED_markers_find_nearest_marker(ListBase *markers, float x)
        
        if (markers) {
                for (marker = markers->first; marker; marker = marker->next) {
-                       dist = ABS((float)marker->frame - x);
+                       dist = fabsf((float)marker->frame - x);
                        
                        if (dist < min_dist) {
                                min_dist = dist;
index fa0c5c655b327046260b159b8815f03283e0b700..0691eb4a9b8b904fb2a95cfe561efd6898bcdb80 100644 (file)
@@ -2335,7 +2335,7 @@ int ui_link_bezier_points(const rcti *rect, float coord_array[][2], int resol)
        vec[3][0] = rect->xmax;
        vec[3][1] = rect->ymax;
        
-       dist = 0.5f * ABS(vec[0][0] - vec[3][0]);
+       dist = 0.5f * fabsf(vec[0][0] - vec[3][0]);
        
        vec[1][0] = vec[0][0] + dist;
        vec[1][1] = vec[0][1];
index d356c3d8de3732c1ddb8afa2dd17abc282a79bf1..5c9778d079301e8c1f8494c8143f3434f512bc62 100644 (file)
@@ -143,7 +143,7 @@ void fdrawbezier(float vec[4][3])
        float dist;
        float curve_res = 24, spline_step = 0.0f;
        
-       dist = 0.5f * ABS(vec[0][0] - vec[3][0]);
+       dist = 0.5f * fabsf(vec[0][0] - vec[3][0]);
        
        /* check direction later, for top sockets */
        vec[1][0] = vec[0][0] + dist;
index 61e7fd89866d1ac38e28d9adf6afc37078eb7a51..3040789852f7825f1d84cc702691879da403bddd 100644 (file)
@@ -3123,7 +3123,7 @@ int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, floa
                toreroute = 0;
        }
 
-       dist = UI_GetThemeValue(TH_NODE_CURVING) * 0.10f * ABS(vec[0][0] - vec[3][0]);
+       dist = UI_GetThemeValue(TH_NODE_CURVING) * 0.10f * fabsf(vec[0][0] - vec[3][0]);
        deltax = vec[3][0] - vec[0][0];
        deltay = vec[3][1] - vec[0][1];
        /* check direction later, for top sockets */
index 4cda56028caad2cb1a233f45e1416507158b4e49..b7dd8b7dc139b97956e2de919e2a6f1c9c76f83b 100644 (file)
@@ -1972,7 +1972,7 @@ static void removeDoublesPeel(ListBase *depth_peels)
        for (peel = depth_peels->first; peel; peel = peel->next) {
                DepthPeel *next_peel = peel->next;
 
-               if (next_peel && ABS(peel->depth - next_peel->depth) < 0.0015f) {
+               if (next_peel && fabsf(peel->depth - next_peel->depth) < 0.0015f) {
                        peel->next = next_peel->next;
                        
                        if (next_peel->next) {