diff options
author | Abseil Team <absl-team@google.com> | 2020-08-07 14:31:44 -0700 |
---|---|---|
committer | Derek Mauro <dmauro@google.com> | 2020-08-07 17:37:02 -0400 |
commit | ce4bc927755fdf0ed03d679d9c7fa041175bb3cb (patch) | |
tree | 5c52c4ae06471b95c7c1affbdd82761a1269b9d2 /absl/base/internal | |
parent | f72cc3516a2b79575f852d125b5324f29e63d91e (diff) |
Export of internal Abseil changes
--
30b56a21feab3443ba40cf97a3bfaa3d5b3bc964 by Derek Mauro <dmauro@google.com>:
Fix conversion warnings on 32-bit MSVC
Fixes #582
PiperOrigin-RevId: 325509591
GitOrigin-RevId: 30b56a21feab3443ba40cf97a3bfaa3d5b3bc964
Change-Id: Icf1786a974eb88ca417cd428c0ce43e8ee8048e7
Diffstat (limited to 'absl/base/internal')
-rw-r--r-- | absl/base/internal/bits.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/absl/base/internal/bits.h b/absl/base/internal/bits.h index 14c51d8b..81648e2c 100644 --- a/absl/base/internal/bits.h +++ b/absl/base/internal/bits.h @@ -83,10 +83,11 @@ ABSL_BASE_INTERNAL_FORCEINLINE int CountLeadingZeros64(uint64_t n) { #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, n >> 32)) { + if ((n >> 32) && + _BitScanReverse(&result, static_cast<unsigned long>(n >> 32))) { return 31 - result; } - if (_BitScanReverse(&result, n)) { + if (_BitScanReverse(&result, static_cast<unsigned long>(n))) { return 63 - result; } return 64; @@ -170,10 +171,10 @@ ABSL_BASE_INTERNAL_FORCEINLINE int CountTrailingZerosNonZero64(uint64_t n) { #elif defined(_MSC_VER) && !defined(__clang__) unsigned long result = 0; // NOLINT(runtime/int) if (static_cast<uint32_t>(n) == 0) { - _BitScanForward(&result, n >> 32); + _BitScanForward(&result, static_cast<unsigned long>(n >> 32)); return result + 32; } - _BitScanForward(&result, n); + _BitScanForward(&result, static_cast<unsigned long>(n)); return result; #elif defined(__GNUC__) || defined(__clang__) static_assert(sizeof(unsigned long long) == sizeof(n), // NOLINT(runtime/int) |