diff options
author | Abseil Team <absl-team@google.com> | 2023-02-06 15:23:40 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-02-06 15:24:24 -0800 |
commit | 92fc445f7c0d8158c5f26abab9049fcfbcd0ccff (patch) | |
tree | 950b231ee5b9c973269a9de775ca45b8e0183e9a /absl/hash/internal/hash.h | |
parent | cdad8cd96ee9bfe11056997dc960eb2e52c6b00e (diff) | |
download | abseil-92fc445f7c0d8158c5f26abab9049fcfbcd0ccff.tar.gz abseil-92fc445f7c0d8158c5f26abab9049fcfbcd0ccff.tar.bz2 abseil-92fc445f7c0d8158c5f26abab9049fcfbcd0ccff.zip |
Fix a discrepancy between absl::Hash and absl::HashOf for some negative signed integral types and improve the performance of absl::Hash.
PiperOrigin-RevId: 507598042
Change-Id: I96a7bd6b9c360f435f216b2671ae84d9768a46e8
Diffstat (limited to 'absl/hash/internal/hash.h')
-rw-r--r-- | absl/hash/internal/hash.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index ccf4cc1a..eb50e2c7 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h @@ -969,7 +969,8 @@ class ABSL_DLL MixingHashState : public HashStateBase<MixingHashState> { // The result should be the same as running the whole algorithm, but faster. template <typename T, absl::enable_if_t<IntegralFastPath<T>::value, int> = 0> static size_t hash(T value) { - return static_cast<size_t>(Mix(Seed(), static_cast<uint64_t>(value))); + return static_cast<size_t>( + Mix(Seed(), static_cast<std::make_unsigned_t<T>>(value))); } // Overload of MixingHashState::hash() |