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:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-02-19 10:29:06 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-02-19 10:29:06 +0300
commit5004b582622144317948262793d5a4199ec90f13 (patch)
tree316e4a783d14609e61c662fe06507acf1c364fe9 /intern/cycles/util
parent57218638052c72d1e25f3201c8356d11bd690834 (diff)
Cycles: Make util_math_fast.h compatible with OpenCL
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/util_math_fast.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/intern/cycles/util/util_math_fast.h b/intern/cycles/util/util_math_fast.h
index 94e08320a16..4ad81e9c015 100644
--- a/intern/cycles/util/util_math_fast.h
+++ b/intern/cycles/util/util_math_fast.h
@@ -362,7 +362,7 @@ ccl_device float fast_log2f(float x)
* negative values/nans. */
clamp(x, FLT_MIN, FLT_MAX);
unsigned bits = __float_as_uint(x);
- int exponent = int(bits >> 23) - 127;
+ int exponent = (int)(bits >> 23) - 127;
float f = __uint_as_float((bits & 0x007FFFFF) | 0x3f800000) - 1.0f;
/* Examined 2130706432 values of log2 on [1.17549435e-38,3.40282347e+38]:
* 0.0797524457 avg ulp diff, 3713596 max ulp, 7.62939e-06 max error.
@@ -404,7 +404,7 @@ ccl_device float fast_logb(float x)
x = fabsf(x);
clamp(x, FLT_MIN, FLT_MAX);
unsigned bits = __float_as_uint(x);
- return int(bits >> 23) - 127;
+ return (int)(bits >> 23) - 127;
}
ccl_device float fast_exp2f(float x)
@@ -412,7 +412,7 @@ ccl_device float fast_exp2f(float x)
/* Clamp to safe range for final addition. */
clamp(x, -126.0f, 126.0f);
/* Range reduction. */
- int m = int(x); x -= m;
+ int m = (int)x; x -= m;
x = 1.0f - (1.0f - x); /* Crush denormals (does not affect max ulps!). */
/* 5th degree polynomial generated with sollya
* Examined 2247622658 values of exp2 on [-126,126]: 2.75764912 avg ulp diff,
@@ -430,7 +430,7 @@ ccl_device float fast_exp2f(float x)
r = madd(x, r, 1.0f);
/* Multiply by 2 ^ m by adding in the exponent. */
/* NOTE: left-shift of negative number is undefined behavior. */
- return __uint_as_float(__float_as_uint(r) + (unsigned(m) << 23));
+ return __uint_as_float(__float_as_uint(r) + ((unsigned)m << 23));
}
ccl_device_inline float fast_expf(float x)