1 (* Author
: sweeks@sweeks
.com
2 * This code is based on the following paper
.
3 * The Performance
of FoxNet
2.0
9 fun checkOne (new
, ac
) =
11 in ac
+ >> (new
, 0w16
) + andb (new
, 0wxFFFF
)
14 fun fold f
b (buf
, first
, last
) =
20 f (Word32
.fromLarge (PackWord32Little
.subArr (buf
, i
)),
26 fun checksum buf
= fold checkOne
0w0 buf
34 val buf
= Word8Array
.array (size
, 0w0
)
36 val last
= size
div bytesPerWord
- 1
40 let val w
= checksum (buf
, first
, last
)
41 val _
= if w
<> 0w0
then raise Fail
"bug" else ()