diff options
| author | Tyge Løvset <[email protected]> | 2023-04-24 14:00:58 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-04-24 14:00:58 +0200 |
| commit | bf118447590bd10d8c6b205a19b25038d84274c2 (patch) | |
| tree | a5755586ad4bda531087ffb7a90e0c3daabc2cb8 /include | |
| parent | 3dcd44ce50df89e698bc9d85cc36518f033b8462 (diff) | |
| download | STC-modified-bf118447590bd10d8c6b205a19b25038d84274c2.tar.gz STC-modified-bf118447590bd10d8c6b205a19b25038d84274c2.zip | |
Final hashing tweak
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/ccommon.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index c1f73e20..4f9fa398 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -147,14 +147,14 @@ 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 << 15) - *x, n = (uint64_t)len >> 3; + uint64_t h = *x << 7, n = (uint64_t)len >> 3; len &= 7; while (n--) { memcpy(&u8, x, 8), x += 8; h = (h ^ u8)*0xc6a4a7935bd1e99d; } while (len--) h = (h ^ *x++)*0x100000001b3; - return h; + return h ^ c_ROTL(h, 26); } STC_INLINE uint64_t cstrhash(const char *str) |
