aboutsummaryrefslogtreecommitdiff
path: root/src/common/tuklib_integer.h
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2019-06-23 19:33:55 +0300
committerLasse Collin <lasse.collin@tukaani.org>2019-06-23 19:33:55 +0300
commit41838dcc26375f6aa393a63e4d81e2f4d223de07 (patch)
tree1ac73755acd5efd59444c7a81efa3cacf337d526 /src/common/tuklib_integer.h
parenttuklib_integer: Fix usage of conv macros. (diff)
downloadxz-41838dcc26375f6aa393a63e4d81e2f4d223de07.tar.xz
tuklib_integer: Silence warnings from -Wsign-conversion.
Diffstat (limited to 'src/common/tuklib_integer.h')
-rw-r--r--src/common/tuklib_integer.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/tuklib_integer.h b/src/common/tuklib_integer.h
index d5c813c0..52564481 100644
--- a/src/common/tuklib_integer.h
+++ b/src/common/tuklib_integer.h
@@ -543,7 +543,7 @@ bsr32(uint32_t n)
// multiple architectures. On x86, __builtin_clz() ^ 31U becomes
// either plain BSR (so the XOR gets optimized away) or LZCNT and
// XOR (if -march indicates that SSE4a instructions are supported).
- return __builtin_clz(n) ^ 31U;
+ return (uint32_t)__builtin_clz(n) ^ 31U;
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
uint32_t i;
@@ -593,7 +593,7 @@ clz32(uint32_t n)
return _bit_scan_reverse(n) ^ 31U;
#elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX == UINT32_MAX
- return __builtin_clz(n);
+ return (uint32_t)__builtin_clz(n);
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
uint32_t i;
@@ -645,7 +645,7 @@ ctz32(uint32_t n)
return _bit_scan_forward(n);
#elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX >= UINT32_MAX
- return __builtin_ctz(n);
+ return (uint32_t)__builtin_ctz(n);
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
uint32_t i;