diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-08-19 20:21:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-08-19 20:21:29 +0400 |
commit | 3a81f23e0975ea87ade780965462ad5b15b39d95 (patch) | |
tree | c0dd7aa326b81598626f6c248bf71063187c715b /source/blender/blenlib | |
parent | 2c1182664cb65e760742ed43fa840cd241d74b4a (diff) |
warning cleanup for -Wdouble-promotion
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/jitter.c | 74 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/rct.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/scanfill.c | 16 |
5 files changed, 55 insertions, 55 deletions
diff --git a/source/blender/blenlib/intern/jitter.c b/source/blender/blenlib/intern/jitter.c index 16f0c86c449..f0e81d6b5e9 100644 --- a/source/blender/blenlib/intern/jitter.c +++ b/source/blender/blenlib/intern/jitter.c @@ -53,10 +53,10 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1) y = jit1[i+1]; for (j = 2*num-2; j>=0 ; j-=2) { if (i != j){ - vecx = jit1[j] - x - 1.0; - vecy = jit1[j+1] - y - 1.0; + vecx = jit1[j] - x - 1.0f; + vecy = jit1[j+1] - y - 1.0f; for (k = 3; k>0 ; k--){ - if( fabs(vecx)<rad1 && fabs(vecy)<rad1) { + if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) { len= sqrt(vecx*vecx + vecy*vecy); if(len>0 && len<rad1) { len= len/rad1; @@ -64,9 +64,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1) dvecy += vecy/len; } } - vecx += 1.0; + vecx += 1.0f; - if( fabs(vecx)<rad1 && fabs(vecy)<rad1) { + if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) { len= sqrt(vecx*vecx + vecy*vecy); if(len>0 && len<rad1) { len= len/rad1; @@ -74,9 +74,9 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1) dvecy += vecy/len; } } - vecx += 1.0; + vecx += 1.0f; - if( fabs(vecx)<rad1 && fabs(vecy)<rad1) { + if( fabsf(vecx)<rad1 && fabsf(vecy)<rad1) { len= sqrt(vecx*vecx + vecy*vecy); if(len>0 && len<rad1) { len= len/rad1; @@ -84,16 +84,16 @@ void BLI_jitterate1(float *jit1, float *jit2, int num, float rad1) dvecy += vecy/len; } } - vecx -= 2.0; - vecy += 1.0; + vecx -= 2.0f; + vecy += 1.0f; } } } - x -= dvecx/18.0 ; - y -= dvecy/18.0; - x -= floor(x) ; - y -= floor(y); + x -= dvecx/18.0f; + y -= dvecy/18.0f; + x -= floorf(x) ; + y -= floorf(y); jit2[i] = x; jit2[i+1] = y; } @@ -111,28 +111,28 @@ void BLI_jitterate2(float *jit1, float *jit2, int num, float rad2) y = jit1[i+1]; for (j =2*num -2; j>= 0 ; j-=2){ if (i != j){ - vecx = jit1[j] - x - 1.0; - vecy = jit1[j+1] - y - 1.0; + vecx = jit1[j] - x - 1.0f; + vecy = jit1[j+1] - y - 1.0f; - if( fabs(vecx)<rad2) dvecx+= vecx*rad2; - vecx += 1.0; - if( fabs(vecx)<rad2) dvecx+= vecx*rad2; - vecx += 1.0; - if( fabs(vecx)<rad2) dvecx+= vecx*rad2; + if( fabsf(vecx)<rad2) dvecx+= vecx*rad2; + vecx += 1.0f; + if( fabsf(vecx)<rad2) dvecx+= vecx*rad2; + vecx += 1.0f; + if( fabsf(vecx)<rad2) dvecx+= vecx*rad2; - if( fabs(vecy)<rad2) dvecy+= vecy*rad2; - vecy += 1.0; - if( fabs(vecy)<rad2) dvecy+= vecy*rad2; - vecy += 1.0; - if( fabs(vecy)<rad2) dvecy+= vecy*rad2; + if( fabsf(vecy)<rad2) dvecy+= vecy*rad2; + vecy += 1.0f; + if( fabsf(vecy)<rad2) dvecy+= vecy*rad2; + vecy += 1.0f; + if( fabsf(vecy)<rad2) dvecy+= vecy*rad2; } } - x -= dvecx/2 ; - y -= dvecy/2; - x -= floor(x) ; - y -= floor(y); + x -= dvecx/2.0f; + y -= dvecy/2.0f; + x -= floorf(x) ; + y -= floorf(y); jit2[i] = x; jit2[i+1] = y; } @@ -148,17 +148,17 @@ void BLI_initjit(float *jitarr, int num) if(num==0) return; jit2= MEM_mallocN(12 + 2*sizeof(float)*num, "initjit"); - rad1= 1.0/sqrt((float)num); - rad2= 1.0/((float)num); - rad3= sqrt((float)num)/((float)num); + rad1= 1.0f/sqrtf((float)num); + rad2= 1.0f/((float)num); + rad3= sqrtf((float)num)/((float)num); BLI_srand(31415926 + num); x= 0; for(i=0; i<2*num; i+=2) { - jitarr[i]= x+ rad1*(0.5-BLI_drand()); - jitarr[i+1]= ((float)i/2)/num +rad1*(0.5-BLI_drand()); + jitarr[i]= x+ rad1*(float)(0.5-BLI_drand()); + jitarr[i+1]= ((float)i/2)/num +rad1*(float)(0.5-BLI_drand()); x+= rad3; - x -= floor(x); + x -= floorf(x); } for (i=0 ; i<24 ; i++) { @@ -171,8 +171,8 @@ void BLI_initjit(float *jitarr, int num) /* finally, move jittertab to be centered around (0,0) */ for(i=0; i<2*num; i+=2) { - jitarr[i] -= 0.5; - jitarr[i+1] -= 0.5; + jitarr[i] -= 0.5f; + jitarr[i+1] -= 0.5f; } } diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index fc329fe1bf1..5b5de3ab3b6 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -402,7 +402,7 @@ int isect_line_sphere_v3(const float l1[3], const float l2[3], madd_v3_v3v3fl(r_p1, l1, ldir, mu); return 1; } - else if (i > 0.0) { + else if (i > 0.0f) { const float i_sqrt= sqrt(i); /* avoid calc twice */ /* first intersection */ @@ -456,7 +456,7 @@ int isect_line_sphere_v2(const float l1[2], const float l2[2], madd_v2_v2v2fl(r_p1, l1, ldir, mu); return 1; } - else if (i > 0.0) { + else if (i > 0.0f) { const float i_sqrt= sqrt(i); /* avoid calc twice */ /* first intersection */ @@ -2010,7 +2010,7 @@ void resolve_quad_uv(float uv[2], const float st[2], const float st0[2], const f } if(IS_ZERO(denom)==0) - uv[1]= (float) (( (1-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom); + uv[1]= (float) (( (1.0f-uv[0])*(st0[i]-st[i]) + uv[0]*(st1[i]-st[i]) ) / denom); } } diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index dfd715ccbf2..e3e507d016a 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -213,7 +213,7 @@ void quat_to_mat4(float m[][4], const float q[4]) double q0, q1, q2, q3, qda,qdb,qdc,qaa,qab,qac,qbb,qbc,qcc; #ifdef DEBUG - if(!((q0=dot_qtqt(q, q))==0.0f || (fabsf(q0-1.0f) < (float)QUAT_EPSILON))) { + if(!((q0=dot_qtqt(q, q))==0.0f || (fabs(q0-1.0) < QUAT_EPSILON))) { fprintf(stderr, "Warning! quat_to_mat4() called with non-normalized: size %.8f *** report a bug ***\n", (float)q0); } #endif @@ -492,8 +492,8 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag) else angle= (float)(-0.5*atan2(-fp[0], -fp[1])); } - co= (float)cos(angle); - si= (float)(sin(angle)/len1); + co= cosf(angle); + si= sinf(angle)/len1; q2[0]= co; q2[1]= x2*si; q2[2]= y2*si; diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index 17b07b49309..31ae8adc2d4 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -233,10 +233,10 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest) void BLI_copy_rcti_rctf(rcti *tar, const rctf *src) { - tar->xmin= floor(src->xmin + 0.5); - tar->xmax= floor((src->xmax - src->xmin) + 0.5); - tar->ymin= floor(src->ymin + 0.5); - tar->ymax= floor((src->ymax - src->ymin) + 0.5); + tar->xmin= floor(src->xmin + 0.5f); + tar->xmax= floor((src->xmax - src->xmin) + 0.5f); + tar->ymin= floor(src->ymin + 0.5f); + tar->ymax= floor((src->ymax - src->ymin) + 0.5f); } void print_rctf(const char *str, rctf *rect) diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 47a07d86e66..b159106f748 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -288,7 +288,7 @@ static short testedgeside(float *v1, float *v2, float *v3) inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy]) +(v1[coy]-v2[coy])*(v1[cox]-v3[cox]); - if(inp<0.0) return 0; + if(inp < 0.0f) return 0; else if(inp==0) { if(v1[cox]==v3[cox] && v1[coy]==v3[coy]) return 0; if(v2[cox]==v3[cox] && v2[coy]==v3[coy]) return 0; @@ -312,8 +312,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed) y= eed->v1->co[coy]; fac1= eed->v2->co[coy]-y; - if(fac1==0.0) { - fac1= 1.0e10*(eed->v2->co[cox]-x); + if(fac1==0.0f) { + fac1= 1.0e10f*(eed->v2->co[cox]-x); } else fac1= (x-eed->v2->co[cox])/fac1; @@ -324,8 +324,8 @@ static short addedgetoscanvert(ScFillVert *sc, EditEdge *eed) if(ed->v2==eed->v2) return 0; fac= ed->v2->co[coy]-y; - if(fac==0.0) { - fac= 1.0e10*(ed->v2->co[cox]-x); + if(fac==0.0f) { + fac= 1.0e10f*(ed->v2->co[cox]-x); } else fac= (x-ed->v2->co[cox])/fac; @@ -443,7 +443,7 @@ static void testvertexnearedge(void) vec2[1]= eed->v2->co[coy]; if(boundinsideEV(eed,eve)) { dist= dist_to_line_v2(vec1,vec2,vec3); - if(dist<COMPLIMIT) { + if(dist<(float)COMPLIMIT) { /* new edge */ ed1= BLI_addfilledge(eed->v1, eve); @@ -816,7 +816,7 @@ int BLI_edgefill(short mat_nr) if(v2) { if( compare_v3v3(v2, eve->co, COMPLIMIT)==0) { len= normal_tri_v3( norm,v1, v2, eve->co); - if(len != 0.0) break; + if(len != 0.0f) break; } } else if(compare_v3v3(v1, eve->co, COMPLIMIT)==0) { @@ -825,7 +825,7 @@ int BLI_edgefill(short mat_nr) eve= eve->next; } - if(len==0.0) return 0; /* no fill possible */ + if(len==0.0f) return 0; /* no fill possible */ norm[0]= fabs(norm[0]); norm[1]= fabs(norm[1]); |