1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 12:03:07 +01:00

Fix #2095. Bitscanforward needs to return -1 if nothing found.

This commit is contained in:
duncanspumpkin
2015-10-20 20:40:17 +01:00
parent 6fb6bb2556
commit 610a7d6954

View File

@@ -144,8 +144,8 @@ int bitscanforward(int source)
int i;
#if _MSC_VER >= 1400 // Visual Studio 2005
_BitScanForward(&i, source);
return i;
uint8 success = _BitScanForward(&i, source);
return success != 0 ? i : -1;
#else
for (i = 0; i < 32; i++)
if (source & (1 << i))