Handbook
Glossary
block-checksum-state
Vocabulary
checksums
.
common
Definition
USING:
checksums
math
;
IN:
checksums.common
TUPLE:
block-checksum-state
<
checksum-state
{
bytes-read
integer
initial:
0
}
{
block-size
integer
initial:
0
}
;
Methods
USING:
accessors
checksums
checksums.common
grouping
kernel
math
math.order
sequences
;
M::
block-checksum-state
add-checksum-bytes
( state data -- checksum-state )
state
bytes>>
:>
bytes state
block-size>>
:>
block-size
bytes
[
data
]
[
length
:>
initial-len block-size initial-len
-
:>
needed needed 0
>
t
assert=
data
dup
length
needed
min
cut-slice
[
state
over
length
[
+
]
curry
change-bytes-read
drop
bytes
push-all
bytes
length
block-size
=
[
bytes state
checksum-block
bytes
delete-all
]
when
]
dip
]
if-empty
dup
length
block-size
mod
cut-slice*
[
block-size
<groups>
[
bytes
push-all
bytes state
[
block-size
+
]
change-bytes-read
checksum-block
bytes
delete-all
]
each
]
[
[
bytes
push-all
]
[
state
swap
length
[
+
]
curry
change-bytes-read
]
bi
]
bi*
;