-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update PAL and GC BitScanReverse
to use __builtin_clz
#89350
Conversation
The existing PAL code was using `__builtin_clzl` which is intended for platforms where `long` is 64 bits. Instead use `__builtin_clz`. The GC version had a similar issue so I've changed that too. The JIT version was already using `__builtin_clz`. Fixes dotnet#89340.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsThe existing PAL code was using The GC version had a similar issue so I've changed that too. The JIT version was already using Fixes #89340.
|
@jakobbotsch PTAL cc @dotnet/jit-contrib |
@@ -300,12 +300,12 @@ inline uint8_t BitScanReverse(uint32_t *bitIndex, uint32_t mask) | |||
#ifdef _MSC_VER | |||
return _BitScanReverse((unsigned long*)bitIndex, mask); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: replace unsigned long
with uint32_t
or just unsigned
to remove confusion?
Surprised it never caused any issues until now 🤔 |
The title of the PR says "BitScanForward" but you're actually changing "BitScanReverse" |
BitScanForward
to use __builtin_clz
BitScanReverse
to use __builtin_clz
Indeed. Thanks. |
Errors are known. |
The existing PAL code was using
__builtin_clzl
which is intended for platforms wherelong
is 64 bits. Instead use__builtin_clz
.The GC version had a similar issue so I've changed that too. The JIT version was already using
__builtin_clz
.Fixes #89340.