aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-05-04 20:30:25 +0800
committerJia Tan <jiat0218@gmail.com>2023-05-04 20:30:25 +0800
commit9ad64bdf309844b6ca6c3e8a4dfb6dbaedda0ca9 (patch)
tree7df5ddace6c71cc0e3ab90ec2c48474128de5963 /src
parenttuklib_integer.h: Changes two other UINT_MAX == UINT32_MAX to >=. (diff)
downloadxz-9ad64bdf309844b6ca6c3e8a4dfb6dbaedda0ca9.tar.xz
tuklib_integer.h: Reverts previous commit.
Previous commit 6be460dde07113fe3f08f814b61ddc3264125a96 would cause an error if the integer size was 32 bit.
Diffstat (limited to 'src')
-rw-r--r--src/common/tuklib_integer.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/tuklib_integer.h b/src/common/tuklib_integer.h
index d6355cc7..24d9efb1 100644
--- a/src/common/tuklib_integer.h
+++ b/src/common/tuklib_integer.h
@@ -636,7 +636,7 @@ bsr32(uint32_t n)
#if defined(__INTEL_COMPILER)
return _bit_scan_reverse(n);
-#elif (TUKLIB_GNUC_REQ(3, 4) || defined(__clang__)) && UINT_MAX >= UINT32_MAX
+#elif (TUKLIB_GNUC_REQ(3, 4) || defined(__clang__)) && UINT_MAX == UINT32_MAX
// GCC >= 3.4 has __builtin_clz(), which gives good results on
// multiple architectures. On x86, __builtin_clz() ^ 31U becomes
// either plain BSR (so the XOR gets optimized away) or LZCNT and
@@ -690,7 +690,7 @@ clz32(uint32_t n)
#if defined(__INTEL_COMPILER)
return _bit_scan_reverse(n) ^ 31U;
-#elif (TUKLIB_GNUC_REQ(3, 4) || defined(__clang__)) && UINT_MAX >= UINT32_MAX
+#elif (TUKLIB_GNUC_REQ(3, 4) || defined(__clang__)) && UINT_MAX == UINT32_MAX
return (uint32_t)__builtin_clz(n);
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))