summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/hash.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/hash.h b/lib/hash.h
index b30f7830..3c173958 100644
--- a/lib/hash.h
+++ b/lib/hash.h
@@ -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));