From 5ad75fb7d06e95cc530ad836a0fa2979136753da Mon Sep 17 00:00:00 2001 From: wrmr Date: Wed, 14 May 2025 23:15:40 -0500 Subject: extra murmur64 hashing step for no reason --- main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index e65eb9d..4755b62 100644 --- a/main.c +++ b/main.c @@ -498,6 +498,15 @@ uint64_t str_hash(Str s) { return h; } +uint64_t murmur64(uint64_t h) { + h ^= h >> 33; + h *= 0xff51afd7ed558ccdL; + h ^= h >> 33; + h *= 0xc4ceb9fe1a85ec53L; + h ^= h >> 33; + return h; +} + /* --hvar bgcolor:'#fcc,#cfc,#ccf,#cff,#ffc,#fcf' */ int hvar_calc(Str param, Str *name, Str *val, Str filename) { Cut c = str_cut(param, ':'); @@ -506,7 +515,7 @@ int hvar_calc(Str param, Str *name, Str *val, Str filename) { usize n = 0; for (Str h = c.tail; h.n > 0; h = str_cut(h, ',').tail) n++; if (!n) return -1; - usize j = str_hash(filename) % n; + usize j = murmur64(str_hash(filename)) % n; usize i = 0; for (Str h = c.tail; h.n > 0; h = str_cut(h, ',').tail) { if (i == j) { -- cgit 1.4.1-2-gfad0