mirror of
https://github.com/greg7mdp/parallel-hashmap.git
synced 2026-08-30 00:50:38 +08:00
Fix warnings with msvc. (#225)
* Fix warnings with msvc. * Fix more warnings.
This commit is contained in:
committed by
GitHub
parent
d3f0b986bf
commit
946ebad67a
Vendored
+5
-5
@@ -276,7 +276,7 @@ PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros64Slow(uint64_t n) {
|
||||
if (n >> 16) zeroes -= 16, n >>= 16;
|
||||
if (n >> 8) zeroes -= 8, n >>= 8;
|
||||
if (n >> 4) zeroes -= 4, n >>= 4;
|
||||
return "\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n] + zeroes;
|
||||
return (uint32_t)("\4\3\2\2\1\1\1\1\0\0\0\0\0\0\0"[n] + zeroes);
|
||||
}
|
||||
|
||||
PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros64(uint64_t n) {
|
||||
@@ -284,17 +284,17 @@ PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros64(uint64_t n) {
|
||||
// MSVC does not have __buitin_clzll. Use _BitScanReverse64.
|
||||
unsigned long result = 0; // NOLINT(runtime/int)
|
||||
if (_BitScanReverse64(&result, n)) {
|
||||
return (int)(63 - result);
|
||||
return (uint32_t)(63 - result);
|
||||
}
|
||||
return 64;
|
||||
#elif defined(_MSC_VER) && !defined(__clang__)
|
||||
// MSVC does not have __buitin_clzll. Compose two calls to _BitScanReverse
|
||||
unsigned long result = 0; // NOLINT(runtime/int)
|
||||
if ((n >> 32) && _BitScanReverse(&result, (unsigned long)(n >> 32))) {
|
||||
return 31 - result;
|
||||
return (uint32_t)(31 - result);
|
||||
}
|
||||
if (_BitScanReverse(&result, (unsigned long)n)) {
|
||||
return 63 - result;
|
||||
return (uint32_t)(63 - result);
|
||||
}
|
||||
return 64;
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
@@ -309,7 +309,7 @@ PHMAP_BASE_INTERNAL_FORCEINLINE uint32_t CountLeadingZeros64(uint64_t n) {
|
||||
if (n == 0) {
|
||||
return 64;
|
||||
}
|
||||
return __builtin_clzll(n);
|
||||
return (uint32_t)__builtin_clzll(n);
|
||||
#else
|
||||
return CountLeadingZeros64Slow(n);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user