[Bf-blender-cvs] [7bd86d74bac] master: Cycles: Fix for non-vectorized version of bitscan()

Sergey Sharybin noreply at git.blender.org
Thu Feb 1 15:17:22 CET 2018


Commit: 7bd86d74bacb0b1f42fbe5ab6ed223f319ef242e
Author: Sergey Sharybin
Date:   Thu Feb 1 15:11:17 2018 +0100
Branches: master
https://developer.blender.org/rB7bd86d74bacb0b1f42fbe5ab6ed223f319ef242e

Cycles: Fix for non-vectorized version of bitscan()

It was doing bit search in an opposite direction comparing to a
vectorized version.

===================================================================

M	intern/cycles/util/util_simd.h

===================================================================

diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h
index f432fd7957a..8f6eb3995b7 100644
--- a/intern/cycles/util/util_simd.h
+++ b/intern/cycles/util/util_simd.h
@@ -454,13 +454,12 @@ ccl_device_inline int bitscan(int value)
 {
 	assert(value != 0);
 	int bit = 0;
-	while(value >>= 1) {
+	while((value & (1 << bit)) == 0) {
 		++bit;
 	}
 	return bit;
 }
 
-
 #endif /* __KERNEL_SSE2__ */
 
 /* quiet unused define warnings */



More information about the Bf-blender-cvs mailing list