aboutsummaryrefslogtreecommitdiff
path: root/c/blake3_impl.h
diff options
context:
space:
mode:
authorAlberto González Palomo <[email protected]>2023-01-19 15:48:49 +0100
committerJack O'Connor <[email protected]>2023-01-19 13:13:32 -0800
commit606a5825d910249094d8d9c78f83d1cabaf5dfb2 (patch)
tree3807a7476a859c9dd550815d8696ac2d60265fbb /c/blake3_impl.h
parente366618d225679e750232bfabe63191e14657289 (diff)
Make sign conversion explicit. Fix #287.
Implicit sign conversions cause warnings when using -Wsign-conversion but that is easy to avoid by making the conversions explicit.
Diffstat (limited to 'c/blake3_impl.h')
-rw-r--r--c/blake3_impl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/c/blake3_impl.h b/c/blake3_impl.h
index 46c8fd8..3ba9ceb 100644
--- a/c/blake3_impl.h
+++ b/c/blake3_impl.h
@@ -87,7 +87,7 @@ static const uint8_t MSG_SCHEDULE[7][16] = {
/* x is assumed to be nonzero. */
static unsigned int highest_one(uint64_t x) {
#if defined(__GNUC__) || defined(__clang__)
- return 63 ^ __builtin_clzll(x);
+ return 63 ^ (unsigned int)__builtin_clzll(x);
#elif defined(_MSC_VER) && defined(IS_X86_64)
unsigned long index;
_BitScanReverse64(&index, x);
@@ -117,7 +117,7 @@ static unsigned int highest_one(uint64_t x) {
// Count the number of 1 bits.
INLINE unsigned int popcnt(uint64_t x) {
#if defined(__GNUC__) || defined(__clang__)
- return __builtin_popcountll(x);
+ return (unsigned int)__builtin_popcountll(x);
#else
unsigned int count = 0;
while (x != 0) {