28 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_LIB 33 static const uint64_t
k0 = 0xc3a5c85c97cb3127ULL;
34 static const uint64_t
k1 = 0xb492b66fbe98f273ULL;
35 static const uint64_t
k2 = 0x9ae16a3b2f90404fULL;
36 static const uint64_t
def_mul = 0x9ddfea08eb382d69ULL;
40 x = ((x << 8) & 0xFF00FF00) | ((x>> 8) & 0x00FF00FF);
41 x = (
x >> 16) | (
x << 16);
74 static inline uint64_t
rotate(uint64_t
val,
int shift)
76 return shift == 0 ?
val : ((
val >> shift) | (
val << (64 - shift)));
81 return shift == 0 ?
val : ((
val >> shift) | (
val << (32 - shift)));
86 const unsigned char *
ptr = (
const unsigned char*)
buffer;
87 uint64_t
val = 14695981039346656037UL;
92 for (
i = 0;
i < len;
i++)
97 static inline uint64_t
hash_len16(uint64_t
u, uint64_t v, uint64_t mul)
99 uint64_t a = (
u ^ v) * mul;
110 uint64_t y, uint64_t z,
111 uint64_t a, uint64_t b)
116 b =
rotate(b + a + z, 21);
121 return M0_UINT128((uint64_t) (a + z), (uint64_t) (b +
c));
125 uint64_t a, uint64_t b)
142 uint64_t mul =
k2 + len * 2;
145 uint64_t
c =
rotate(b, 37) * mul + a;
146 uint64_t d = (
rotate(a, 25) + b) * mul;
151 uint64_t mul =
k2 + len * 2;
160 uint8_t b =
buffer[len >> 1];
162 uint32_t y = a + (b << 8);
163 uint32_t z = len + (
c << 2);
172 uint64_t mul =
k2 + len * 2;
184 uint64_t mul =
k2 + len * 2;
194 uint64_t v = ((a +
g) ^ d) +
f + 1;
195 uint64_t w =
swap_64((
u + v) * mul) + h;
197 uint64_t y = (
swap_64((v + w) * mul) +
g) * mul;
198 uint64_t z = e +
f +
c;
201 b =
shift_mix((z + a) * mul + d + h) * mul;
207 const unsigned char *
ptr = (
const unsigned char*)
buffer;
257 #undef M0_TRACE_SUBSYSTEM static void ptr(struct m0_addb2__context *ctx, const uint64_t *v, char *buf)
static struct m0_uint128 weak_hash32_seeds(const unsigned char *s, uint64_t a, uint64_t b)
static uint64_t rotate(uint64_t val, int shift)
static uint64_t swap_64(uint64_t x)
static uint64_t hash_len16(uint64_t u, uint64_t v, uint64_t mul)
static uint64_t shift_mix(uint64_t val)
static uint64_t fetch32(const unsigned char *val)
static struct m0_addb2_callback c
M0_INTERNAL uint64_t m0_hash_fnc_fnv1(const void *buffer, m0_bcount_t len)
M0_INTERNAL uint64_t m0_hash_fnc_city(const void *buffer, m0_bcount_t len)
static uint32_t swap_32(uint32_t x)
static uint64_t hash_17to32(const unsigned char *buffer, size_t len)
static uint64_t hash_0to16(const unsigned char *buffer, m0_bcount_t len)
static uint64_t fetch64(const unsigned char *val)
static struct m0_clink l[NR]
static const uint64_t def_mul
static uint64_t hash_33to64(const unsigned char *buffer, size_t len)
static M0_UNUSED uint32_t rotate32(uint32_t val, int shift)
#define M0_UINT128(hi, lo)
static struct m0_uint128 weak_hash32_seeds_6(uint64_t w, uint64_t x, uint64_t y, uint64_t z, uint64_t a, uint64_t b)
static struct gen g[MAX_GEN]
static struct m0_addb2_source * s