summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwrmr2025-05-14 23:15:40 -0500
committerwrmr2025-05-14 23:15:40 -0500
commit5ad75fb7d06e95cc530ad836a0fa2979136753da (patch)
tree225c82da6d1e7a0aaaaab5a9054051b3e352cd1c
parent5275f6b7043d399e6dc99f5ab532ac37a1f1bfda (diff)
extra murmur64 hashing step for no reason
-rw-r--r--main.c11
1 files changed, 10 insertions, 1 deletions
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) {