Cycles: Fix for wrong clamp usage in fast math

This commit is contained in:
Sergey Sharybin 2015-05-06 00:01:16 +05:00
parent 4616a7a4d3
commit b45ad4b214
1 changed files with 3 additions and 3 deletions

View File

@ -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!). */