在 2018/5/23 21:10, Martin Storsjö 写道:
+#if __INTRINSIC_PROLOG(_BitScanReverse)
+__MINGW_EXTENSION unsigned char _BitScanReverse(unsigned __LONG32 *Index,
unsigned __LONG32 Mask);
+#if !__has_builtin(_BitScanReverse)
+__MINGW_EXTENSION __INTRINSICS_USEINLINE
+unsigned char _BitScanReverse(unsigned __LONG32 *Index, unsigned __LONG32 Mask)
+{
+ if (Mask == 0)
+ return 0;
+ *Index = 31 - __builtin_clz(Mask);
Is hardcoding `31` here safe? The use of `__LONG32` reminds me about the
fact that MSYS2 for x64 shares some of our headers but expects `long` to
be 64-bit long, where `31` apparently will cause trouble.
Maybe it could be changed to
```
*Index = 31 - (__builtin_clz(Mask) - (__LONG_WIDTH__ - 32));
```
which is then equivalent to
```
*Index = __LONG_WIDTH__ - 1 - __builtin_clz(Mask);
```
?
--
Best regards,
LH_Mouse
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public