diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-09 21:45:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-09 21:45:22 +0400 |
commit | 43361487bad926a9b32ce879f5b6961154507dfc (patch) | |
tree | 6a91b1e7709fbd85c9b70e735e81db71edb20ab2 /intern/cycles/util | |
parent | 0fbb6bff27139d66951fe223ff322c609d368a18 (diff) |
code cleanup: quiet all warnings about double promotion (either by changing the type or explicitly casting).
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_color.h | 6 | ||||
-rw-r--r-- | intern/cycles/util/util_math.h | 6 | ||||
-rw-r--r-- | intern/cycles/util/util_transform.cpp | 16 |
3 files changed, 14 insertions, 14 deletions
diff --git a/intern/cycles/util/util_color.h b/intern/cycles/util/util_color.h index 8b4a175f498..5136ea5c5db 100644 --- a/intern/cycles/util/util_color.h +++ b/intern/cycles/util/util_color.h @@ -29,15 +29,15 @@ __device float color_srgb_to_scene_linear(float c) if(c < 0.04045f) return (c < 0.0f)? 0.0f: c * (1.0f/12.92f); else - return pow((c + 0.055f)*(1.0f/1.055f), 2.4f); + return powf((c + 0.055f) * (1.0f / 1.055f), 2.4f); } __device float color_scene_linear_to_srgb(float c) { if(c < 0.0031308f) return (c < 0.0f)? 0.0f: c * 12.92f; - else - return 1.055f * pow(c, 1.0f/2.4f) - 0.055f; + else + return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f; } #ifndef __KERNEL_OPENCL__ diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index cd44b7e8cda..a6bc478ee64 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -334,7 +334,7 @@ __device_inline float2 as_float2(const float4 a) __device_inline void print_float2(const char *label, const float2& a) { - printf("%s: %.8f %.8f\n", label, a.x, a.y); + printf("%s: %.8f %.8f\n", label, (double)a.x, (double)a.y); } #endif @@ -532,7 +532,7 @@ __device_inline float4 float3_to_float4(const float3 a) __device_inline void print_float3(const char *label, const float3& a) { - printf("%s: %.8f %.8f %.8f\n", label, a.x, a.y, a.z); + printf("%s: %.8f %.8f %.8f\n", label, (double)a.x, (double)a.y, (double)a.z); } __device_inline float3 rcp(const float3& a) @@ -844,7 +844,7 @@ __device_inline float4 reduce_add(const float4& a) __device_inline void print_float4(const char *label, const float4& a) { - printf("%s: %.8f %.8f %.8f %.8f\n", label, a.x, a.y, a.z, a.w); + printf("%s: %.8f %.8f %.8f %.8f\n", label, (double)a.x, (double)a.y, (double)a.z, (double)a.w); } #endif diff --git a/intern/cycles/util/util_transform.cpp b/intern/cycles/util/util_transform.cpp index 860f2d4d888..b3c6506dfa0 100644 --- a/intern/cycles/util/util_transform.cpp +++ b/intern/cycles/util/util_transform.cpp @@ -160,15 +160,15 @@ static float4 transform_to_quat(const Transform& tfm) double trace = tfm[0][0] + tfm[1][1] + tfm[2][2]; float4 qt; - if(trace > 0.0f) { + if(trace > 0.0) { double s = sqrt(trace + 1.0); qt.w = (float)(s/2.0); s = 0.5/s; - qt.x = (float)((tfm[2][1] - tfm[1][2]) * s); - qt.y = (float)((tfm[0][2] - tfm[2][0]) * s); - qt.z = (float)((tfm[1][0] - tfm[0][1]) * s); + qt.x = (float)((double)(tfm[2][1] - tfm[1][2]) * s); + qt.y = (float)((double)(tfm[0][2] - tfm[2][0]) * s); + qt.z = (float)((double)(tfm[1][0] - tfm[0][1]) * s); } else { int i = 0; @@ -181,16 +181,16 @@ static float4 transform_to_quat(const Transform& tfm) int j = (i + 1)%3; int k = (j + 1)%3; - double s = sqrt((tfm[i][i] - (tfm[j][j] + tfm[k][k])) + 1.0); + double s = sqrt((double)(tfm[i][i] - (tfm[j][j] + tfm[k][k])) + 1.0); double q[3]; q[i] = s * 0.5; if(s != 0.0) s = 0.5/s; - double w = (tfm[k][j] - tfm[j][k]) * s; - q[j] = (tfm[j][i] + tfm[i][j]) * s; - q[k] = (tfm[k][i] + tfm[i][k]) * s; + double w = (double)(tfm[k][j] - tfm[j][k]) * s; + q[j] = (double)(tfm[j][i] + tfm[i][j]) * s; + q[k] = (double)(tfm[k][i] + tfm[i][k]) * s; qt.x = (float)q[0]; qt.y = (float)q[1]; |