Cycles: Move non-vectorized bitscan() to util
This way we can use bitscan() from both vectorized and non-vectorized code, which applies to both kernel and host code.
This commit is contained in:
@@ -34,21 +34,6 @@
|
|||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
#if !defined(__KERNEL_SSE2__)
|
|
||||||
/* TODO(sergey): Move to some generic header so all code
|
|
||||||
* can use bitscan on non-SSE processors.
|
|
||||||
*/
|
|
||||||
ccl_device_inline int bitscan(int value)
|
|
||||||
{
|
|
||||||
assert(value != 0);
|
|
||||||
int bit = 0;
|
|
||||||
while(value >>= 1) {
|
|
||||||
++bit;
|
|
||||||
}
|
|
||||||
return bit;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* BVH Build Task */
|
/* BVH Build Task */
|
||||||
|
|
||||||
class BVHBuildTask : public Task {
|
class BVHBuildTask : public Task {
|
||||||
|
@@ -430,6 +430,23 @@ __forceinline __int64 _mm_extract_epi64( __m128i input, const int index ) {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#else /* __KERNEL_SSE2__ */
|
||||||
|
|
||||||
|
/* This section is for utility functions which operates on non-register data
|
||||||
|
* which might be used from a non-vectorized code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
ccl_device_inline int bitscan(int value)
|
||||||
|
{
|
||||||
|
assert(value != 0);
|
||||||
|
int bit = 0;
|
||||||
|
while(value >>= 1) {
|
||||||
|
++bit;
|
||||||
|
}
|
||||||
|
return bit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* __KERNEL_SSE2__ */
|
#endif /* __KERNEL_SSE2__ */
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
Reference in New Issue
Block a user