Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/farmhash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ template <> uint128_t DebugTweak(uint128_t x) {

} // namespace NAMESPACE_FOR_HASH_FUNCTIONS

using namespace std;
using namespace NAMESPACE_FOR_HASH_FUNCTIONS;
namespace farmhashna {
#undef Fetch
Expand Down Expand Up @@ -480,19 +479,19 @@ STATIC_INLINE uint64_t HashLen17to32(const char *s, size_t len) {

// Return a 16-byte hash for 48 bytes. Quick and dirty.
// Callers do best to use "random-looking" values for a and b.
STATIC_INLINE pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(
STATIC_INLINE std::pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(
uint64_t w, uint64_t x, uint64_t y, uint64_t z, uint64_t a, uint64_t b) {
a += w;
b = Rotate(b + a + z, 21);
uint64_t c = a;
a += x;
a += y;
b += Rotate(a, 44);
return make_pair(a + z, b + c);
return std::make_pair(a + z, b + c);
}

// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
STATIC_INLINE pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(
STATIC_INLINE std::pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(
const char* s, uint64_t a, uint64_t b) {
return WeakHashLen32WithSeeds(Fetch(s),
Fetch(s + 8),
Expand Down Expand Up @@ -536,8 +535,8 @@ uint64_t Hash64(const char *s, size_t len) {
uint64_t x = seed;
uint64_t y = seed * k1 + 113;
uint64_t z = ShiftMix(y * k2 + 113) * k2;
pair<uint64_t, uint64_t> v = make_pair(0, 0);
pair<uint64_t, uint64_t> w = make_pair(0, 0);
std::pair<uint64_t, uint64_t> v = std::make_pair(0, 0);
std::pair<uint64_t, uint64_t> w = std::make_pair(0, 0);
x = x * k2 + Fetch(s);

// Set end so that after the loop we have 1 to 64 bytes left to process.
Expand Down Expand Up @@ -609,8 +608,8 @@ uint64_t Hash64WithSeeds(const char *s, size_t len,
uint64_t x = seed0;
uint64_t y = seed1 * k2 + 113;
uint64_t z = farmhashna::ShiftMix(y * k2) * k2;
pair<uint64_t, uint64_t> v = make_pair(seed0, seed1);
pair<uint64_t, uint64_t> w = make_pair(0, 0);
std::pair<uint64_t, uint64_t> v = std::make_pair(seed0, seed1);
std::pair<uint64_t, uint64_t> w = std::make_pair(0, 0);
uint64_t u = x - z;
x *= k2;
uint64_t mul = k2 + (u & 0x82);
Expand Down Expand Up @@ -1743,19 +1742,19 @@ STATIC_INLINE uint64_t HashLen0to16(const char *s, size_t len) {

// Return a 16-byte hash for 48 bytes. Quick and dirty.
// Callers do best to use "random-looking" values for a and b.
STATIC_INLINE pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(
STATIC_INLINE std::pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(
uint64_t w, uint64_t x, uint64_t y, uint64_t z, uint64_t a, uint64_t b) {
a += w;
b = Rotate(b + a + z, 21);
uint64_t c = a;
a += x;
a += y;
b += Rotate(a, 44);
return make_pair(a + z, b + c);
return std::make_pair(a + z, b + c);
}

// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
STATIC_INLINE pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(
STATIC_INLINE std::pair<uint64_t, uint64_t> WeakHashLen32WithSeeds(
const char* s, uint64_t a, uint64_t b) {
return WeakHashLen32WithSeeds(Fetch(s),
Fetch(s + 8),
Expand Down Expand Up @@ -1806,7 +1805,7 @@ uint128_t CityHash128WithSeed(const char *s, size_t len, uint128_t seed) {

// We expect len >= 128 to be the common case. Keep 56 bytes of state:
// v, w, x, y, and z.
pair<uint64_t, uint64_t> v, w;
std::pair<uint64_t, uint64_t> v, w;
uint64_t x = Uint128Low64(seed);
uint64_t y = Uint128High64(seed);
uint64_t z = len * k1;
Expand Down