diff options
author | Benjamin Barenblat <bbaren@google.com> | 2021-04-08 10:23:55 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2021-04-08 10:23:55 -0400 |
commit | feac56827dd1f0d159ea0bcf2ce37ef1990ac743 (patch) | |
tree | bc8ca767be02a5b22118108f9712b72ec64064c3 /absl/hash/internal/city.h | |
parent | 2b91b17d526b464840a3f45504c594cdb50152c5 (diff) | |
parent | 997aaf3a28308eba1b9156aa35ab7bca9688e9f6 (diff) |
Merge new upstream LTS 20210324.0
Diffstat (limited to 'absl/hash/internal/city.h')
-rw-r--r-- | absl/hash/internal/city.h | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/absl/hash/internal/city.h b/absl/hash/internal/city.h index 161c7748..393da0b9 100644 --- a/absl/hash/internal/city.h +++ b/absl/hash/internal/city.h @@ -56,11 +56,6 @@ namespace absl { ABSL_NAMESPACE_BEGIN namespace hash_internal { -typedef std::pair<uint64_t, uint64_t> uint128; - -inline uint64_t Uint128Low64(const uint128 &x) { return x.first; } -inline uint64_t Uint128High64(const uint128 &x) { return x.second; } - // Hash function for a byte array. uint64_t CityHash64(const char *s, size_t len); @@ -71,24 +66,11 @@ uint64_t CityHash64WithSeed(const char *s, size_t len, uint64_t seed); // Hash function for a byte array. For convenience, two seeds are also // hashed into the result. uint64_t CityHash64WithSeeds(const char *s, size_t len, uint64_t seed0, - uint64_t seed1); + uint64_t seed1); // Hash function for a byte array. Most useful in 32-bit binaries. uint32_t CityHash32(const char *s, size_t len); -// Hash 128 input bits down to 64 bits of output. -// This is intended to be a reasonably good hash function. -inline uint64_t Hash128to64(const uint128 &x) { - // Murmur-inspired hashing. - const uint64_t kMul = 0x9ddfea08eb382d69ULL; - uint64_t a = (Uint128Low64(x) ^ Uint128High64(x)) * kMul; - a ^= (a >> 47); - uint64_t b = (Uint128High64(x) ^ a) * kMul; - b ^= (b >> 47); - b *= kMul; - return b; -} - } // namespace hash_internal ABSL_NAMESPACE_END } // namespace absl |