aboutsummaryrefslogtreecommitdiff
path: root/zencore/include
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-09-16 11:32:35 +0200
committerMartin Ridgers <[email protected]>2021-09-16 13:17:45 +0200
commit930b0e66b0df613c398c4cc11db03d42eef99d6b (patch)
tree1510e6628711c9d29ff4036fbe5dd014e1448c33 /zencore/include
parentMerge from main (diff)
downloadzen-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.h8
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