[Bf-blender-cvs] [b45ad4b] master: Cycles: Fix for wrong clamp usage in fast math
Sergey Sharybin
noreply at git.blender.org
Tue May 5 21:01:47 CEST 2015
Commit: b45ad4b2143f29430eebdc37014172b216d71720
Author: Sergey Sharybin
Date: Wed May 6 00:01:16 2015 +0500
Branches: master
https://developer.blender.org/rBb45ad4b2143f29430eebdc37014172b216d71720
Cycles: Fix for wrong clamp usage in fast math
===================================================================
M intern/cycles/util/util_math_fast.h
===================================================================
diff --git a/intern/cycles/util/util_math_fast.h b/intern/cycles/util/util_math_fast.h
index 1acceee..c1a1be6 100644
--- a/intern/cycles/util/util_math_fast.h
+++ b/intern/cycles/util/util_math_fast.h
@@ -360,7 +360,7 @@ ccl_device float fast_log2f(float x)
{
/* NOTE: clamp to avoid special cases and make result "safe" from large
* negative values/nans. */
- clamp(x, FLT_MIN, FLT_MAX);
+ x = clamp(x, FLT_MIN, FLT_MAX);
unsigned bits = __float_as_uint(x);
int exponent = (int)(bits >> 23) - 127;
float f = __uint_as_float((bits & 0x007FFFFF) | 0x3f800000) - 1.0f;
@@ -402,7 +402,7 @@ ccl_device float fast_logb(float x)
{
/* Don't bother with denormals. */
x = fabsf(x);
- clamp(x, FLT_MIN, FLT_MAX);
+ x = clamp(x, FLT_MIN, FLT_MAX);
unsigned bits = __float_as_uint(x);
return (int)(bits >> 23) - 127;
}
@@ -410,7 +410,7 @@ ccl_device float fast_logb(float x)
ccl_device float fast_exp2f(float x)
{
/* Clamp to safe range for final addition. */
- clamp(x, -126.0f, 126.0f);
+ x = clamp(x, -126.0f, 126.0f);
/* Range reduction. */
int m = (int)x; x -= m;
x = 1.0f - (1.0f - x); /* Crush denormals (does not affect max ulps!). */
More information about the Bf-blender-cvs
mailing list