| uint32_t Hash64WithSeedsLow(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { |
| return static_cast<uint32_t>(Hash64WithSeeds(s, len, seed0, seed1)); |
| } |
| |
| uint32_t Hash64WithSeedsHigh(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { |
| return static_cast<uint32_t>(Hash64WithSeeds(s, len, seed0, seed1) >> 32); |
| } |
| |
| // Hash the concatenation of the given string with itself. |
| uint64_t Hash64WithSeedsD(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { |
| char buf[8000]; |
| char* ss = len*2 > sizeof(buf) ? (char*)malloc(len*2) : buf; |
| memcpy(ss, s, len); |
| memcpy(ss + len, s, len); |
| uint64_t h = Hash64WithSeeds(ss, len*2, seed0, seed1); |
| if (ss != buf) free(ss); |
| return h; |
| } |
| |
| // Hash the concatenation of the given string with itself. |
| uint32_t Hash64WithSeedsDLow(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { |
| return static_cast<uint32_t>(Hash64WithSeedsD(s, len, seed0, seed1)); |
| } |
| |
| // Hash the concatenation of the given string with itself. |
| uint32_t Hash64WithSeedsDHigh(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { |
| return static_cast<uint32_t>(Hash64WithSeedsD(s, len, seed0, seed1) >> 32); |
| } |
| |
| // Hash the concatenation of the given string with 3 copies of itself. |
| uint64_t Hash64WithSeedsQ(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { |
| char buf[8000]; |
| char* ss = len*4 > sizeof(buf) ? (char*)malloc(len*4) : buf; |
| memcpy(ss, s, len); |
| memcpy(ss + len, s, len); |
| memcpy(ss + len*2, ss, len*2); |
| uint64_t h = Hash64WithSeeds(ss, len*4, seed0, seed1); |
| if (ss != buf) free(ss); |
| return h; |
| } |
| |
| // Hash the concatenation of the given string with 3 copies of itself. |
| uint32_t Hash64WithSeedsQLow(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { |
| return static_cast<uint32_t>(Hash64WithSeedsQ(s, len, seed0, seed1)); |
| } |
| |
| // Hash the concatenation of the given string with 3 copies of itself. |
| uint32_t Hash64WithSeedsQHigh(const char* s, size_t len, uint64_t seed0, uint64_t seed1) { |
| return static_cast<uint32_t>(Hash64WithSeedsQ(s, len, seed0, seed1) >> 32); |
| } |