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:
authorCampbell Barton <ideasman42@gmail.com>2014-05-04 21:49:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-05-04 21:49:22 +0400
commitd828d44d7a934e6e9c8fb492c8f788e91fda16ff (patch)
treed9ae1cf32ab6d26d2d663ca1611ac7036485bb98 /intern/cycles/util/util_math.h
parentdc13969e484ed9fa6834b1aba85ba00f65bf8a11 (diff)
Cycles: use LIKELY/UNLIKELY macros
Gives overall ~3% speedup in own tests for BMW scene.
Diffstat (limited to 'intern/cycles/util/util_math.h')
-rw-r--r--intern/cycles/util/util_math.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h
index 53ed6817258..ded75762cd2 100644
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@ -1237,7 +1237,7 @@ ccl_device float compatible_powf(float x, float y)
ccl_device float safe_powf(float a, float b)
{
- if(a < 0.0f && b != float_to_int(b))
+ if(UNLIKELY(a < 0.0f && b != float_to_int(b)))
return 0.0f;
return compatible_powf(a, b);
@@ -1245,7 +1245,7 @@ ccl_device float safe_powf(float a, float b)
ccl_device float safe_logf(float a, float b)
{
- if(a < 0.0f || b < 0.0f)
+ if(UNLIKELY(a < 0.0f || b < 0.0f))
return 0.0f;
return logf(a)/logf(b);
@@ -1305,7 +1305,7 @@ ccl_device bool ray_aligned_disk_intersect(
float3 disk_N = normalize_len(ray_P - disk_P, &disk_t);
float div = dot(ray_D, disk_N);
- if(div == 0.0f)
+ if(UNLIKELY(div == 0.0f))
return false;
/* compute t to intersection point */
@@ -1335,7 +1335,7 @@ ccl_device bool ray_triangle_intersect(
float3 s1 = cross(ray_D, e2);
const float divisor = dot(s1, e1);
- if(divisor == 0.0f)
+ if(UNLIKELY(divisor == 0.0f))
return false;
const float invdivisor = 1.0f/divisor;
@@ -1378,7 +1378,7 @@ ccl_device bool ray_triangle_intersect_uv(
float3 s1 = cross(ray_D, e2);
const float divisor = dot(s1, e1);
- if(divisor == 0.0f)
+ if(UNLIKELY(divisor == 0.0f))
return false;
const float invdivisor = 1.0f/divisor;