diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hash.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -216,6 +216,14 @@ mem_hash_mix(u64 *h, const void *p, uint s) } static inline void +mem_hash_mix_str(u64 *h, const char *s) +{ + const u64 multiplier = 0xb38bc09a61202731ULL; + while (s) + *h = *h * multiplier + *s++; +} + +static inline void mem_hash_mix_num(u64 *h, u64 val) { mem_hash_mix(h, &val, sizeof(val)); |