Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-04 11:18:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-04 11:18:29 +0400
commitfae6c35ca7ae4e73cc32a0f5c235fd0ff8f00be1 (patch)
tree7caea3d796c18cddf661960a243de565847173c5 /source/blender/blenlib
parent89a454653e9ff7704671aeb371b1b387af6152dc (diff)
code cleanup: quiet -Wdouble-promotion, disabled this warnings for a few files since its done throughout the code in some places.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/math_geom.c6
-rw-r--r--source/blender/blenlib/intern/math_matrix.c8
-rw-r--r--source/blender/blenlib/intern/math_rotation.c8
-rw-r--r--source/blender/blenlib/intern/math_vector.c2
-rw-r--r--source/blender/blenlib/intern/rct.c8
5 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c
index a01ba846cab..e10229f11da 100644
--- a/source/blender/blenlib/intern/math_geom.c
+++ b/source/blender/blenlib/intern/math_geom.c
@@ -2356,8 +2356,8 @@ void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const
const double a = (st0[0] - st[0]) * (st0[1] - st3[1]) - (st0[1] - st[1]) * (st0[0] - st3[0]);
/* B = ( (p0 - p) X (p1 - p2) + (p1 - p) X (p0 - p3) ) / 2 */
- const double b = 0.5 * (((st0[0] - st[0]) * (st1[1] - st2[1]) - (st0[1] - st[1]) * (st1[0] - st2[0])) +
- ((st1[0] - st[0]) * (st0[1] - st3[1]) - (st1[1] - st[1]) * (st0[0] - st3[0])));
+ const double b = 0.5 * (double)(((st0[0] - st[0]) * (st1[1] - st2[1]) - (st0[1] - st[1]) * (st1[0] - st2[0])) +
+ ((st1[0] - st[0]) * (st0[1] - st3[1]) - (st1[1] - st[1]) * (st0[0] - st3[0])));
/* C = (p1-p) X (p1-p2) */
const double fC = (st1[0] - st[0]) * (st1[1] - st2[1]) - (st1[1] - st[1]) * (st1[0] - st2[0]);
@@ -2393,7 +2393,7 @@ void resolve_quad_uv(float r_uv[2], const float st[2], const float st0[2], const
}
if (IS_ZERO(denom) == 0)
- r_uv[1] = (float)(((1.0f - r_uv[0]) * (st0[i] - st[i]) + r_uv[0] * (st1[i] - st[i])) / denom);
+ r_uv[1] = (float)((double)((1.0f - r_uv[0]) * (st0[i] - st[i]) + r_uv[0] * (st1[i] - st[i])) / denom);
}
}
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c
index 2b7c23ce67e..f622a5ace35 100644
--- a/source/blender/blenlib/intern/math_matrix.c
+++ b/source/blender/blenlib/intern/math_matrix.c
@@ -603,15 +603,15 @@ int invert_m4_m4(float inverse[4][4], float mat[4][4])
if (temp == 0)
return 0; /* No non-zero pivot */
for (k = 0; k < 4; k++) {
- tempmat[i][k] = (float)(tempmat[i][k] / temp);
- inverse[i][k] = (float)(inverse[i][k] / temp);
+ tempmat[i][k] = (float)((double)tempmat[i][k] / temp);
+ inverse[i][k] = (float)((double)inverse[i][k] / temp);
}
for (j = 0; j < 4; j++) {
if (j != i) {
temp = tempmat[j][i];
for (k = 0; k < 4; k++) {
- tempmat[j][k] -= (float)(tempmat[i][k] * temp);
- inverse[j][k] -= (float)(inverse[i][k] * temp);
+ tempmat[j][k] -= (float)((double)tempmat[i][k] * temp);
+ inverse[j][k] -= (float)((double)inverse[i][k] * temp);
}
}
}
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 589e6462f62..b0c4724e1ec 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -234,7 +234,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.0) < (float)QUAT_EPSILON))) {
+ if (!((q0 = dot_qtqt(q, q)) == 0.0 || (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
@@ -288,9 +288,9 @@ void mat3_to_quat(float q[4], float wmat[][3])
s = sqrt(tr);
q[0] = (float)s;
s = 1.0 / (4.0 * s);
- q[1] = (float)((mat[1][2] - mat[2][1]) * s);
- q[2] = (float)((mat[2][0] - mat[0][2]) * s);
- q[3] = (float)((mat[0][1] - mat[1][0]) * s);
+ q[1] = (float)((double)(mat[1][2] - mat[2][1]) * s);
+ q[2] = (float)((double)(mat[2][0] - mat[0][2]) * s);
+ q[3] = (float)((double)(mat[0][1] - mat[1][0]) * s);
}
else {
if (mat[0][0] > mat[1][1] && mat[0][0] > mat[2][2]) {
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index 7c9c5f60126..976895fe6fc 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -492,7 +492,7 @@ double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int s
const float *array_pt_b = array_src_b + (size - 1);
int i = size;
while (i--) {
- d += *(array_pt_a--) * *(array_pt_b--);
+ d += (double)(*(array_pt_a--) * *(array_pt_b--));
}
return d;
}
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 2e2619df24e..ee073d5d309 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -105,25 +105,25 @@ int BLI_rctf_isect_pt_v(const rctf *rect, const float xy[2])
static int isect_segments_i(const int v1[2], const int v2[2], const int v3[2], const int v4[2])
{
const double div = (double)((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
- if (div == 0.0f) {
+ if (div == 0.0) {
return 1; /* co-linear */
}
else {
const double labda = (double)((v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
const double mu = (double)((v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
- return (labda >= 0.0f && labda <= 1.0f && mu >= 0.0f && mu <= 1.0f);
+ return (labda >= 0.0 && labda <= 1.0 && mu >= 0.0 && mu <= 1.0);
}
}
static int isect_segments_fl(const float v1[2], const float v2[2], const float v3[2], const float v4[2])
{
const double div = (double)((v2[0] - v1[0]) * (v4[1] - v3[1]) - (v2[1] - v1[1]) * (v4[0] - v3[0]));
- if (div == 0.0f) {
+ if (div == 0.0) {
return 1; /* co-linear */
}
else {
const double labda = (double)((v1[1] - v3[1]) * (v4[0] - v3[0]) - (v1[0] - v3[0]) * (v4[1] - v3[1])) / div;
const double mu = (double)((v1[1] - v3[1]) * (v2[0] - v1[0]) - (v1[0] - v3[0]) * (v2[1] - v1[1])) / div;
- return (labda >= 0.0f && labda <= 1.0f && mu >= 0.0f && mu <= 1.0f);
+ return (labda >= 0.0 && labda <= 1.0 && mu >= 0.0 && mu <= 1.0);
}
}