Handbook
Glossary
hash64-0to16 ( bytes -- hash )
Vocabulary
checksums
.
cityhash
.
private
Inputs
bytes
an
object
Outputs
hash
an
object
Definition
USING:
combinators
math
math.bitwise
sequences
;
IN:
checksums.cityhash.private
::
hash64-0to16
( bytes -- hash )
bytes
length
:>
len
k2
len 2
*
W+
:>
mul
{
{
[
len 8
>=
]
[
bytes 0
fetch64
k2
W+
:>
a bytes len 8
-
fetch64
:>
b b -37
bitroll-64
mul
W*
a
W+
a -25
bitroll-64
b
W+
mul
W*
mul
hash16-mul
]
}
{
[
len 4
>=
]
[
bytes 0
fetch32
3
shift
len
W+
bytes len 4
-
fetch32
mul
hash16-mul
]
}
{
[
len 0
>
]
[
bytes
first
len -1
shift
bytes
nth
8
shift
+
k2
W*
len bytes
last
2
shift
+
k0
W*
bitxor
shift-mix
k2
W*
]
}
[
k2
]
}
cond
;