Skip to content

Commit ec36fa8

Browse files
committed
Merge branch 'master' of github.com:greg7mdp/parallel-hashmap
2 parents 75196c4 + def2038 commit ec36fa8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

parallel_hashmap/phmap_bits.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros32Slow(uint64_t n) {
321321
if (n >> 16) zeroes -= 16, n >>= 16;
322322
if (n >> 8) zeroes -= 8, n >>= 8;
323323
if (n >> 4) zeroes -= 4, n >>= 4;
324-
return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n] + zeroes;
324+
return static_cast<uint32_t>("\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n]) + zeroes;
325325
}
326326

327327
PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros32(uint32_t n) {
@@ -343,7 +343,7 @@ PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros32(uint32_t n) {
343343
if (n == 0) {
344344
return 32;
345345
}
346-
return __builtin_clz(n);
346+
return static_cast<uint32_t>(__builtin_clz(n));
347347
#else
348348
return CountLeadingZeros32Slow(n);
349349
#endif
@@ -377,7 +377,7 @@ PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountTrailingZerosNonZero64(uint64_t n)
377377
#elif defined(__GNUC__) || defined(__clang__)
378378
static_assert(sizeof(unsigned long long) == sizeof(n), // NOLINT(runtime/int)
379379
"__builtin_ctzll does not take 64-bit arg");
380-
return __builtin_ctzll(n);
380+
return static_cast<uint32_t>(__builtin_ctzll(n));
381381
#else
382382
return CountTrailingZerosNonZero64Slow(n);
383383
#endif
@@ -402,7 +402,7 @@ PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountTrailingZerosNonZero32(uint32_t n)
402402
#elif defined(__GNUC__) || defined(__clang__)
403403
static_assert(sizeof(int) == sizeof(n),
404404
"__builtin_ctz does not take 32-bit arg");
405-
return __builtin_ctz(n);
405+
return static_cast<uint32_t>(__builtin_ctz(n));
406406
#else
407407
return CountTrailingZerosNonZero32Slow(n);
408408
#endif

0 commit comments

Comments
 (0)