From 5004b582622144317948262793d5a4199ec90f13 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 19 Feb 2015 12:29:06 +0500 Subject: Cycles: Make util_math_fast.h compatible with OpenCL --- intern/cycles/util/util_math_fast.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'intern/cycles/util') 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) -- cgit v1.2.3