Commit 701224e9 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Move hash_128_to_64 to top of file

Summary: [Folly] Move `hash_128_to_64` to top of file - it has no dependencies so there was no need to split the declaration and definition across 500 lines.

Reviewed By: Orvid

Differential Revision: D17276906

fbshipit-source-id: f57133e8873d8b1afcfd5ab119e07615f6ee9018
parent 1c76bae6
......@@ -39,7 +39,21 @@
namespace folly {
namespace hash {
uint64_t hash_128_to_64(const uint64_t upper, const uint64_t lower) noexcept;
// This is the Hash128to64 function from Google's cityhash (available
// under the MIT License). We use it to reduce multiple 64 bit hashes
// into a single hash.
inline uint64_t hash_128_to_64(
const uint64_t upper,
const uint64_t lower) noexcept {
// Murmur-inspired hashing.
const uint64_t kMul = 0x9ddfea08eb382d69ULL;
uint64_t a = (lower ^ upper) * kMul;
a ^= (a >> 47);
uint64_t b = (upper ^ a) * kMul;
b ^= (b >> 47);
b *= kMul;
return b;
}
//////////////////////////////////////////////////////////////////////
......@@ -596,22 +610,6 @@ class StdHasher {
// commutative_hash_combine_* hashes values but combines them in an
// order-independent way to yield a new hash.
// This is the Hash128to64 function from Google's cityhash (available
// under the MIT License). We use it to reduce multiple 64 bit hashes
// into a single hash.
inline uint64_t hash_128_to_64(
const uint64_t upper,
const uint64_t lower) noexcept {
// Murmur-inspired hashing.
const uint64_t kMul = 0x9ddfea08eb382d69ULL;
uint64_t a = (lower ^ upper) * kMul;
a ^= (a >> 47);
uint64_t b = (upper ^ a) * kMul;
b ^= (b >> 47);
b *= kMul;
return b;
}
template <class Hash, class Value>
uint64_t commutative_hash_combine_value_generic(
uint64_t seed,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment