platform.h (lines 552-553): _BitScanReverse #323

Closed
opened 2026-01-29 20:42:01 +00:00 by claunia · 1 comment
Owner

Originally created by @dejanyy on GitHub (May 22, 2020).

On lines 552-553 of platform.h we have:

uint32_t msb;
_BitScanReverse(&msb, x);

I think "uint32_t msb;" is wrong. Certainly doesn't compile with MS Visual Studio 2017. Changing that line to "unsigned long msb;" seems to fix the problem. See:
https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64?view=vs-2019

Originally created by @dejanyy on GitHub (May 22, 2020). On lines 552-553 of platform.h we have: uint32_t msb; _BitScanReverse(&msb, x); I think "uint32_t msb;" is wrong. Certainly doesn't compile with MS Visual Studio 2017. Changing that line to "unsigned long msb;" seems to fix the problem. See: https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64?view=vs-2019
Author
Owner

@eustas commented on GitHub (Jul 2, 2020):

Indeed! I believe it is compiled in CI only by an accident (when uint32_t is the same type as unsigned long).
Going to fix soon. Thanks for the report!

@eustas commented on GitHub (Jul 2, 2020): Indeed! I believe it is compiled in CI only by an accident (when `uint32_t` is the same type as `unsigned long`). Going to fix soon. Thanks for the report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#323