summaryrefslogtreecommitdiffhomepage
path: root/include/stc/ccommon.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-04-23 20:02:29 +0200
committerTyge Løvset <[email protected]>2023-04-23 20:02:29 +0200
commitee619c6ef061c4adb2b13985ebb7d2c67551c84a (patch)
treecfd0b41788cbdb2e4788b625b15024ac6e0c6576 /include/stc/ccommon.h
parente78f0ed961c3d0f34b63e113247194fc9eafa636 (diff)
downloadSTC-modified-ee619c6ef061c4adb2b13985ebb7d2c67551c84a.tar.gz
STC-modified-ee619c6ef061c4adb2b13985ebb7d2c67551c84a.zip
Tuned cmap.h and hash function.
Diffstat (limited to 'include/stc/ccommon.h')
-rw-r--r--include/stc/ccommon.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 2453143c..bac25fb1 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -147,13 +147,13 @@ STC_INLINE uint64_t cfasthash(const void* key, intptr_t len) {
case 0: return 1;
}
const uint8_t *x = (const uint8_t*)key;
- uint64_t h = *x*0x811c9dc5ULL, n = (uint64_t)len >> 3;
+ uint64_t h = *x | (*x << 15), n = (uint64_t)len >> 3;
len &= 7;
while (n--) {
memcpy(&u8, x, 8), x += 8;
- h = (h ^ u8)*0x01000193ULL;
+ h = (h ^ u8)*0x9e3779b97f4a7c15;
}
- while (len--) h = (h ^ *x++)*0x01000193ULL;
+ while (len--) h = (h ^ *x++)*0xbf58476d1ce4e5b9;
return h;
}