Code Cleanup: avoid double promotion.

This commit is contained in:
2012-02-04 06:55:29 +00:00
parent a05fdb837b
commit deec4ce0bc
15 changed files with 20 additions and 20 deletions

View 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]);

View 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 );

View 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 {

View 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 */

View 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;

View 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;
}

View 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);

View 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;
}
}

View 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);

View 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;

View 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);

View 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)

View File

@@ -298,7 +298,7 @@ static void meshdeformModifier_do(
fac= 1.0f - fac;
}
if (fac <= 0.0) {
if (fac <= 0.0f) {
continue;
}
}

View 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 */

View 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;