Optimize bitscanforward using intrinsic function

This commit is contained in:
Daniël Heres committed 2015-10-20 18:06:03 +02:00
1 parent 3f99209219
commit 6cf6c4be25
1 file changed
+5
+5
View File
@@ -143,11 +143,16 @@ int bitscanforward(int source)
{
int i;
#if _MSC_VER >= 1400 // Visual Studio 2005
_BitScanForward(&i, source);
return i;
#else
for (i = 0; i < 32; i++)
if (source & (1 << i))
return i;
return -1;
#endif
}
int bitcount(int source)