Code Cleanup: avoid double promotion.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 4 Feb 2012 06:55:29 +0000 (06:55 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 4 Feb 2012 06:55:29 +0000 (06:55 +0000)
15 files changed:
source/blender/blenfont/intern/blf_glyph.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenlib/intern/math_color.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_clip/clip_graph_ops.c
source/blender/editors/space_sequencer/sequencer_scopes.c
source/blender/editors/transform/transform.c
source/blender/modifiers/intern/MOD_meshdeform.c
source/blender/render/intern/source/occlusion.c
source/blender/render/intern/source/zbuf.c

index 0e7cbb8cf1c3ff9485b2b8afec4e4aeebf5f463f..ab7ef8072a9808741fe34db50ec78f2065ab3bdb 100644 (file)
@@ -305,7 +305,7 @@ static void blf_texture_draw(float uv[2][2], float dx, float y1, float dx1, floa
        /* When a string is being rendered as individual glyphs (as in the game
         * engine), the leading edge needs to be raised a fraction to prevent
         * z-fighting for kerned characters. - z0r */
-       float twist = (dx1 - dx) * 0.0002;
+       const float twist = (dx1 - dx) * 0.0002f;
 
        glBegin(GL_QUADS);
        glTexCoord2f(uv[0][0], uv[0][1]);
index d86fc5c9aeff78d7a3fb932efd8c31a2623fb16b..1beaa59baadc0510939dffe8bc142ac87ef9b2db 100644 (file)
@@ -1151,7 +1151,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
                spring->kl = MAX2(mface[i].v4, mface[i].v2);
                spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
                spring->type = CLOTH_SPRING_TYPE_SHEAR;
-               spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0;
+               spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0f;
 
                BLI_linklist_append ( &edgelist[spring->ij], spring );
                BLI_linklist_append ( &edgelist[spring->kl], spring );
index 33b17f27ac8a38590a40961d90c794abffa32380..ad89a9c959fab5d201781c3df8bc427ffb26dcb8 100644 (file)
@@ -492,7 +492,7 @@ static void contarget_get_mesh_mat (Object *ob, const char *substring, float mat
                        copy_v3_v3(plane, tmat[1]);
                        
                        cross_v3_v3v3(mat[0], normal, plane);
-                       if(len_v3(mat[0]) < 1e-3) {
+                       if(len_v3(mat[0]) < 1e-3f) {
                                copy_v3_v3(plane, tmat[0]);
                                cross_v3_v3v3(mat[0], normal, plane);
                        }
@@ -1263,7 +1263,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr
                                        /* If the curve is cyclic, enable looping around if the time is
                                         * outside the bounds 0..1 */
                                        if ((curvetime < 0.0f) || (curvetime > 1.0f)) {
-                                               curvetime -= floor(curvetime);
+                                               curvetime -= floorf(curvetime);
                                        }
                                }
                                else {
index 318165af80402fc1156da246d7823cac41bb6a9d..5feeb4c300dac2b83792376c49db8334c186a9c6 100644 (file)
@@ -1987,7 +1987,7 @@ static float fcurve_eval_keyframes (FCurve *fcu, BezTriple *bezts, float evaltim
                for (a=0; prevbezt && bezt && (a < fcu->totvert-1); a++, prevbezt=bezt, bezt++) 
                {
                        /* use if the key is directly on the frame, rare cases this is needed else we get 0.0 instead. */
-                       if(fabs(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) {
+                       if(fabsf(bezt->vec[1][0] - evaltime) < SMALL_NUMBER) {
                                cvalue= bezt->vec[1][1];
                        }
                        /* evaltime occurs within the interval defined by these two keyframes */
index a8f89b0a1eb176453178028eea78b25df2bd9bd1..9edcc7a73e88dcaf4477b4cebab898e76b8c13f5 100644 (file)
@@ -1583,7 +1583,7 @@ typedef struct WipeZone {
 static void precalc_wipe_zone(WipeZone *wipezone, WipeVars *wipe, int xo, int yo)
 {
        wipezone->flip = (wipe->angle < 0);
-       wipezone->angle = tan(DEG2RAD(fabsf(wipe->angle)));
+       wipezone->angle = tanf(DEG2RADF(fabsf(wipe->angle)));
        wipezone->xo = xo;
        wipezone->yo = yo;
        wipezone->width = (int)(wipe->edgeWidth*((xo+yo)/2.0f));
@@ -1602,9 +1602,9 @@ static float in_band(float width,float dist,int side,int dir)
                return (float)side;
 
        if(side == 1)
-               alpha = (dist+0.5*width) / (width);
+               alpha = (dist+0.5f*width) / (width);
        else
-               alpha = (0.5*width-dist) / (width);
+               alpha = (0.5f*width-dist) / (width);
 
        if(dir == 0)
                alpha = 1-alpha;
index ca2aeca8f3636c1dd8456a3903176f5043977d26..b9772b1f3b4f53c72c784138083717a9386fb938 100644 (file)
@@ -561,7 +561,7 @@ void BLI_init_srgb_conversion(void)
        for (i = 0; i < 0x10000; i++) {
                float f = linearrgb_to_srgb(index_to_float(i))*255.0f;
                if (f <= 0) BLI_color_to_srgb_table[i] = 0;
-               else if (f < 255) BLI_color_to_srgb_table[i] = (unsigned short)(f*0x100+.5);
+               else if (f < 255) BLI_color_to_srgb_table[i] = (unsigned short)(f*0x100+0.5f);
                else BLI_color_to_srgb_table[i] = 0xff00;
        }
 
index 9b7c49023c5e1cd088b704aa890ee09e626dd096..93cb0f8ae9768a117a0a66c8aceed5bc3fb6d3b5 100644 (file)
@@ -1533,8 +1533,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
                        zoomx= (float)width / (scopes->track_preview->x-2*margin);
                        zoomy= (float)height / (scopes->track_preview->y-2*margin);
 
-                       off_x= ((int)track_pos[0]-track_pos[0]+0.5)*zoomx;
-                       off_y= ((int)track_pos[1]-track_pos[1]+0.5)*zoomy;
+                       off_x= ((int)track_pos[0]-track_pos[0]+0.5f)*zoomx;
+                       off_y= ((int)track_pos[1]-track_pos[1]+0.5f)*zoomy;
 
                        drawibuf= scale_trackpreview_ibuf(scopes->track_preview, track_pos, width, height, margin);
 
index dbc153de108ae55e8fa43673ebc4e45e1cfca85a..c528d8cd0783f16b4f67006bbc6b82e0c83a3b1b 100644 (file)
@@ -109,7 +109,7 @@ static float get_fluid_viscosity(FluidsimSettings *settings)
                        return 2.0e-3;
                case 1:         /* manual */
                default:
-                       return (1.0/pow(10.0, settings->viscosityExponent)) * settings->viscosityValue;
+                       return (1.0f/powf(10.0f, settings->viscosityExponent)) * settings->viscosityValue;
        }
 }
 
index ce84e43955b642a243f20483446d486800ace15f..d05582512ae6df4d0273d5e73fbb7d4fa683f61a 100644 (file)
@@ -3153,7 +3153,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
                dx = cache->mouse[0] - cache->initial_mouse[0];
                dy = cache->mouse[1] - cache->initial_mouse[1];
 
-               cache->vertex_rotation = -atan2(dx, dy) * cache->bstrength;
+               cache->vertex_rotation = -atan2f(dx, dy) * cache->bstrength;
 
                sd->draw_anchored = 1;
                copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse);
index 6a56de266899c02dbba282b2804859307018d220..f902422ab4395ee9d7788645fae3c6669635cf90 100644 (file)
@@ -450,7 +450,7 @@ void CLIP_OT_graph_view_all(wmOperatorType *ot)
 void ED_clip_graph_center_current_frame(Scene *scene, ARegion *ar)
 {
        View2D *v2d = &ar->v2d;
-       float extra = (v2d->cur.xmax - v2d->cur.xmin) / 2.0;
+       float extra = (v2d->cur.xmax - v2d->cur.xmin) / 2.0f;
 
        /* set extents of view to start/end frames */
        v2d->cur.xmin = (float)CFRA - extra;
index 2bb40ce51f44e79c064cfc97d095edafd987b08f..c13a5202c19615eac0cfc6a5759fbdbc3250e710 100644 (file)
@@ -170,7 +170,7 @@ static struct ImBuf *make_waveform_view_from_ibuf_byte(struct ImBuf * ibuf)
 
                for (x = 0; x < ibuf->x; x++) {
                        unsigned char * rgb = src + 4 * (ibuf->x * y + x);
-                       float v = (float)rgb_to_luma_byte(rgb) / 255.0;
+                       float v = (float)rgb_to_luma_byte(rgb) / 255.0f;
                        unsigned char * p = tgt;
                        p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1);
 
index 41e7356ad104f91480d9c4b8704f61623be8fdbe..9d368476f03ebb9d8cdd21d8fffa7ee78fb13eb5 100644 (file)
@@ -5566,9 +5566,9 @@ static void headerTimeTranslate(TransInfo *t, char *str)
                /* apply snapping + frame->seconds conversions */
                if (autosnap == SACTSNAP_STEP) {
                        if (doTime)
-                               val= floor((double)val/secf + 0.5f);
+                               val= floorf((double)val/secf + 0.5f);
                        else
-                               val= floor(val + 0.5f);
+                               val= floorf(val + 0.5f);
                }
                else {
                        if (doTime)
index e6e2c0fd6212a6abce41e5470b59d0e17a41b2ff..d80c6715f9dad788d3fd01f8a216c3fdadfc64ae 100644 (file)
@@ -298,7 +298,7 @@ static void meshdeformModifier_do(
                                fac= 1.0f - fac;
                        }
 
-                       if (fac <= 0.0) {
+                       if (fac <= 0.0f) {
                                continue;
                        }
                }
index 782e0b59388f667949a32576d7767a7672dab17e..669355c9977a35d9dfad8e1ceff4c712bfd51b83 100644 (file)
@@ -1408,7 +1408,7 @@ static void sample_occ_tree(Render *re, OcclusionTree *tree, OccFace *exclude, f
        occlusion= (1.0f-correction)*(1.0f-occ);
        CLAMP(occlusion, 0.0f, 1.0f);
        if(correction != 0.0f)
-               occlusion += correction*exp(-occ);
+               occlusion += correction*expf(-occ);
 
        if(env) {
                /* sky shading using bent normal */
index 0d5aed7dadb1503360e3929e4f656280319ae25c..807a3d7d0ebb81d1e00781303c9c68bc565c9a54 100644 (file)
@@ -245,7 +245,7 @@ int testclip(const float v[4])
        
        /* if we set clip flags, the clipping should be at least larger than epsilon. 
           prevents issues with vertices lying exact on borders */
-       abs4= fabs(v[3]) + FLT_EPSILON;
+       abs4= fabsf(v[3]) + FLT_EPSILON;
        
        if( v[0] < -abs4) c+=1;
        else if( v[0] > abs4) c+=2;