1 ! Copyright (C) 2006, 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel math math.bitwise strings io.binary namespaces
9 : calculate-pad-length ( length -- pad-length )
10 dup 56 < 55 119 ? swap - ;
12 : pad-last-block ( str big-endian? length -- str )
16 dup HEX: 3f bitand calculate-pad-length 0 <string> %
17 3 shift 8 rot [ >be ] [ >le ] if %
20 : update-old-new ( old new -- )
21 [ get >r get r> ] 2keep >r >r w+ dup r> set r> set ; inline