checksums.common: some cleanup, remove unused stuff.
parent
a284660490
commit
b6367aba06
|
@ -1,23 +1,14 @@
|
||||||
! Copyright (C) 2006, 2008 Doug Coleman.
|
! Copyright (C) 2006, 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel math math.bitwise strings io.binary namespaces
|
USING: byte-arrays grouping io.binary kernel make math ;
|
||||||
make grouping byte-arrays ;
|
|
||||||
IN: checksums.common
|
IN: checksums.common
|
||||||
|
|
||||||
SYMBOL: bytes-read
|
|
||||||
|
|
||||||
: calculate-pad-length ( length -- length' )
|
: calculate-pad-length ( length -- length' )
|
||||||
[ 56 < 55 119 ? ] keep - ;
|
[ 56 < 55 119 ? ] keep - ;
|
||||||
|
|
||||||
: calculate-pad-length-long ( length -- length' )
|
: pad-last-block ( bytes big-endian? length -- blocks )
|
||||||
[ 120 < 119 247 ? ] keep - ;
|
|
||||||
|
|
||||||
: pad-last-block ( str big-endian? length -- str )
|
|
||||||
[
|
[
|
||||||
[ % ] 2dip 0x80 ,
|
[ % ] 2dip 0x80 ,
|
||||||
[ 0x3f bitand calculate-pad-length <byte-array> % ]
|
[ 0x3f bitand calculate-pad-length <byte-array> % ]
|
||||||
[ 3 shift 8 rot [ >be ] [ >le ] if % ] bi
|
[ 3 shift 8 rot [ >be ] [ >le ] if % ] bi
|
||||||
] B{ } make 64 group ;
|
] B{ } make 64 group ;
|
||||||
|
|
||||||
: update-old-new ( old new -- )
|
|
||||||
[ [ get ] bi@ w+ dup ] 2keep [ set ] bi@ ; inline
|
|
||||||
|
|
Loading…
Reference in New Issue