diff options
| author | Martin Ridgers <[email protected]> | 2021-09-16 11:32:35 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-09-16 13:17:45 +0200 |
| commit | 930b0e66b0df613c398c4cc11db03d42eef99d6b (patch) | |
| tree | 1510e6628711c9d29ff4036fbe5dd014e1448c33 /zencore/include | |
| parent | Merge from main (diff) | |
| download | zen-930b0e66b0df613c398c4cc11db03d42eef99d6b.tar.xz zen-930b0e66b0df613c398c4cc11db03d42eef99d6b.zip | |
Corrected Clang/GCC implementations of _Bsr/f
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/intmath.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/zencore/include/zencore/intmath.h b/zencore/include/zencore/intmath.h index 814a03df4..2fdea22b5 100644 --- a/zencore/include/zencore/intmath.h +++ b/zencore/include/zencore/intmath.h @@ -21,7 +21,7 @@ _BitScanReverse(unsigned long* Index, uint32_t Mask) return 0; } - *Index = __builtin_clz(Mask); + *Index = 31 - __builtin_clz(Mask); return 1; } @@ -33,8 +33,8 @@ _BitScanReverse64(unsigned long* Index, uint64_t Mask) return 0; } - *Index = __builtin_clzll(Mask); - return 0; + *Index = 63 - __builtin_clzll(Mask); + return 1; } inline uint8_t @@ -46,7 +46,7 @@ _BitScanForward64(unsigned long* Index, uint64_t Mask) } *Index = __builtin_ctzll(Mask); - return 0; + return 1; } #endif |