summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mason <davmason@microsoft.com>2018-03-26 13:25:32 -0700
committerGitHub <noreply@github.com>2018-03-26 13:25:32 -0700
commitfa15aac7fe11d951c4b85dcb9a23285007e0c620 (patch)
treeb7566647637675ea9b607d8d4767f655d5c4a0a6
parent091462cf01f8da3ffdd9e3bf9935f81aa621ab77 (diff)
downloadcoreclr-fa15aac7fe11d951c4b85dcb9a23285007e0c620.tar.gz
coreclr-fa15aac7fe11d951c4b85dcb9a23285007e0c620.tar.bz2
coreclr-fa15aac7fe11d951c4b85dcb9a23285007e0c620.zip
[local gc] Fix for BitScanForward64, it was ignoring the high byte check (#17142)
-rw-r--r--src/gc/env/gcenv.base.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gc/env/gcenv.base.h b/src/gc/env/gcenv.base.h
index e1d40d6003..b695abc7fa 100644
--- a/src/gc/env/gcenv.base.h
+++ b/src/gc/env/gcenv.base.h
@@ -253,12 +253,18 @@ inline uint8_t BitScanForward64(uint32_t *bitIndex, uint64_t mask)
uint32_t hi = (mask >> 32) & 0xFFFFFFFF;
uint32_t lo = mask & 0xFFFFFFFF;
uint32_t fakeBitIndex = 0;
- if (BitScanForward(&fakeBitIndex, hi))
+
+ uint8_t result = BitScanForward(bitIndex, lo);
+ if (result == 0)
{
- *bitIndex = fakeBitIndex + 32;
+ result = BitScanForward(&fakeBitIndex, hi);
+ if (result != 0)
+ {
+ *bitIndex = fakeBitIndex + 32;
+ }
}
- return BitScanForward(bitIndex, lo);
+ return result;
#else
return _BitScanForward64((unsigned long*)bitIndex, mask);
#endif // _WIN32