Fix Cycles light tree render errors on Windows

Due to mistake in popcount implementation. Thanks to Weizhen for help
figuring this out.
This commit is contained in:
Brecht Van Lommel 2022-12-06 16:50:26 +01:00
parent 8f213e7436
commit 16b6116b9d
1 changed files with 2 additions and 2 deletions

View File

@ -796,11 +796,11 @@ ccl_device float bits_to_01(uint bits)
ccl_device_inline uint popcount(uint x)
{
/* TODO(Stefan): pop-count intrinsic for Windows with fallback for older CPUs. */
uint i = x & 0xaaaaaaaa;
uint i = x;
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
i = (((i + (i >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
return i & 1;
return i;
}
# endif
#elif defined(__KERNEL_ONEAPI__)