summaryrefslogtreecommitdiff
path: root/lib/std/hashfuncs.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/hashfuncs.myr')
-rw-r--r--lib/std/hashfuncs.myr14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/std/hashfuncs.myr b/lib/std/hashfuncs.myr
index 023f63a..eca00c9 100644
--- a/lib/std/hashfuncs.myr
+++ b/lib/std/hashfuncs.myr
@@ -144,23 +144,21 @@ const murmurhash2 = {data, seed
-> h
}
-const rotl = {x, n -> uint64; -> (x << n) | (x >> (64 - n))}
-
const sipround = {v0, v1, v2, v3 -> (uint64, uint64, uint64, uint64)
v0 += v1
- v1 = rotl(v1, 13)
+ v1 = (v1 << 13) | (v1 >> 51)
v1 ^= v0
- v0 = rotl(v0, 32)
+ v0 = (v0 << 32) | (v0 >> 32)
v2 += v3
- v3 = rotl(v3, 16)
+ v3 = (v3 << 16) | (v3 >> 48)
v3 ^= v2
v2 += v1
- v1 = rotl(v1, 17)
+ v1 = (v1 << 17) | (v1 >> 47)
v1 ^= v2
- v2 = rotl(v2, 32)
+ v2 = (v2 << 32) | (v2 >> 32)
v0 += v3
- v3 = rotl(v3, 21)
+ v3 = (v3 << 21) | (v3 >> 43)
v3 ^= v0
-> (v0, v1, v2, v3)