! See http://factorcode.org/license.txt for BSD license
USING: accessors alien.c-types alien.data byte-arrays checksums
-grouping io.binary kernel literals math math.bitwise math.order
-sequences sequences.generalizations ;
-
+endian grouping kernel math math.bitwise
+sequences sequences.generalizations sequences.private ;
IN: checksums.wyhash
<PRIVATE
:: wymum ( a b -- a' b' )
- a -32 shift 32 bits >bignum :> Ha
- b -32 shift 32 bits >bignum :> Hb
- a 32 bits >bignum :> La
- b 32 bits >bignum :> Lb
+ a -32 shift 32 bits :> Ha
+ b -32 shift 32 bits :> Hb
+ a 32 bits :> La
+ b 32 bits :> Lb
Ha Hb W* :> RH
Ha Lb W* :> RM0
Hb La W* :> RM1
:: native-mapper ( from to bytes c-type -- seq )
from to bytes <slice>
- bytes byte-array? little-endian? and
+ bytes byte-array? alien.data:little-endian? and
[ c-type cast-array ]
[ c-type heap-size <groups> [ le> ] map ] if ; inline
seed :> see1!
seed :> see2!
6 <groups> [
- 6 firstn :> ( n0 n1 n2 n3 n4 n5 )
+ 6 firstn-unsafe :> ( n0 n1 n2 n3 n4 n5 )
n0 P1 bitxor n1 seed bitxor wymix seed!
n2 P2 bitxor n3 see1 bitxor wymix see1!
n4 P3 bitxor n5 see2 bitxor wymix see2!
len/48 len/16 bytes uint64_t native-mapper [
2 <groups> [
- first2 :> ( n0 n1 )
+ first2-unsafe :> ( n0 n1 )
n0 P1 bitxor n1 seed bitxor wymix seed!
] each
] unless-empty