INSTANCE: internet checksum
M: internet checksum-bytes
- drop 0 swap 2 <sliced-groups> [ le> + ] each
+ drop 0 swap 2 <groups> [ le> + ] each
[ -16 shift ] [ 0xffff bitand ] bi +
[ -16 shift ] keep + bitnot 2 >le ;
: byte-array>le ( byte-array -- byte-array )
little-endian? [
- dup 4 <sliced-groups> [
+ dup 4 <groups> [
[ [ 1 2 ] dip exchange-unsafe ]
[ [ 0 3 ] dip exchange-unsafe ] bi
] each
[ w+ a ] dip set-nth-unsafe ; inline
: prepare-message-schedule ( seq sha2 -- w-seq )
- [ word-size>> <sliced-groups> [ be> ] map ]
+ [ word-size>> <groups> [ be> ] map ]
[
block-size>> [ 0 pad-tail 16 ] keep [a,b) over
'[ _ prepare-M-256 ] each
} 2cleave set-nth-unsafe ;
: prepare-sha1-message-schedule ( seq -- w-seq )
- 4 <sliced-groups> [ be> ] map
+ 4 <groups> [ be> ] map
80 0 pad-tail 16 80 [a,b) over
'[ _ sha1-W ] each ; inline
] unit-test
[ t ] [
- [ { array } declare 2 <sliced-groups> [ . . ] assoc-each ]
+ [ { array } declare 2 <groups> [ . . ] assoc-each ]
\ nth-unsafe inlined?
] unit-test
native-endianness get-global dup endianness get = [
2drop
] [
- [ [ <sliced-groups> ] keep ] dip
+ [ [ <groups> ] keep ] dip
little-endian = [
'[ be> _ >le ] map
] [
[ pixels h rowstride * memory>byte-array ]
[
pixels rowstride h * uchar <c-direct-array>
- rowstride <sliced-groups>
+ rowstride <groups>
[ bytes-per-row head-slice ] map concat
] if
] ;
ALIAS: end second-unsafe
: find-interval ( key interval-set -- slice )
- array>> 2 <sliced-groups>
+ array>> 2 <groups>
[ start <=> ] with search nip ; inline
ERROR: not-an-interval-set obj ;
"SPECIALIZED-ARRAY: char"
""
"\"mydata.dat\" char ["
- " 4 <sliced-groups>"
+ " 4 <groups>"
" [ reverse! drop ] each"
"] with-mapped-array"
}
: hexdump-bytes ( bytes -- )
[ length write-header ]
- [ 16 <sliced-groups> [ write-hex-line ] each-index ] bi ;
+ [ 16 <groups> [ write-hex-line ] each-index ] bi ;
PRIVATE>
] ;
: [>object-param] ( class count -- quot )
- nip '[ _ <sliced-groups> ] ;
+ nip '[ _ <groups> ] ;
: [>param] ( type -- quot )
c-type-count over c-type-name?
double-array{ 1.0 2.0 3.0 } ,
"hello world" 4 tail-slice ,
10 f <repetition> ,
- 100 iota 2 <sliced-groups> ,
+ 100 iota 2 <groups> ,
"hello" <reversed> ,
{ { 1 2 } { 3 4 } } 0 <column> ,
?{ t f t } ,
double-array{ 1.0 2.0 3.0 } ,
"hello world" 4 tail-slice ,
10 f <repetition> ,
- 100 2 <sliced-groups> ,
+ 100 2 <groups> ,
"hello" <reversed> ,
f ,
{ { 1 2 } { 3 4 } } 0 <column> ,
a b c [ vertexes nth [ n v+ ] change-normal drop ] tri@ ; inline
: calc-bunny-normals ( vertexes indexes -- )
- 3 <sliced-groups> swap
+ 3 <groups> swap
[ [ first3 ] dip calc-bunny-normal ] curry each ; inline
: normalize-bunny-normals ( vertexes -- )
[ nip ] [ drop color-index-length ] if read >>color-index ;
: alpha-used? ( loading-bitmap -- ? )
- color-index>> 4 <sliced-groups> [ fourth 0 = ] all? not ;
+ color-index>> 4 <groups> [ fourth 0 = ] all? not ;
GENERIC: bitmap>component-order* ( loading-bitmap header -- object )
: color-lookup3 ( loading-bitmap -- seq )
[ color-index>> >array ]
- [ color-palette>> 3 <sliced-groups> ] bi
+ [ color-palette>> 3 <groups> ] bi
'[ _ nth ] map concat ;
: color-lookup4 ( loading-bitmap -- seq )
[ color-index>> >array ]
- [ color-palette>> 4 <sliced-groups> [ 3 head-slice ] map ] bi
+ [ color-palette>> 4 <groups> [ 3 head-slice ] map ] bi
'[ _ nth ] map concat ;
! os2v1 is 3bytes each, all others are 3 + 1 unused
loading-png width>> :> width
loading-png bit-depth>> :> bit-depth
loading-png png-components-per-pixel :> #bytes!
- width height * f <array> width <sliced-groups> :> image
+ width height * f <array> width <groups> :> image
bit-depth 16 = [
#bytes 2 * #bytes!
[ pass 7 < ] [
ba loading-png pass read-adam7-subimage
- #bytes <sliced-groups>
+ #bytes <groups>
pass starting-row nth row!
pass starting-col nth col!
{
{ 1 [ ] } ! blank
{ 2 [ ] } ! read c strings here
- { 3 [ 2 <sliced-groups> [ endian> ] map ] }
- { 4 [ 4 <sliced-groups> [ endian> ] map ] }
- { 5 [ 8 <sliced-groups> [ "II" unpack first2 / ] map ] }
+ { 3 [ 2 <groups> [ endian> ] map ] }
+ { 4 [ 4 <groups> [ endian> ] map ] }
+ { 5 [ 8 <groups> [ "II" unpack first2 / ] map ] }
{ 6 [ [ 8 >signed ] map ] }
{ 7 [ ] } ! blank
- { 8 [ 2 <sliced-groups> [ endian> 16 >signed ] map ] }
- { 9 [ 4 <sliced-groups> [ endian> 32 >signed ] map ] }
+ { 8 [ 2 <groups> [ endian> 16 >signed ] map ] }
+ { 9 [ 4 <groups> [ endian> 32 >signed ] map ] }
{ 10 [ 8 group [ "ii" unpack first2 / ] map ] }
{ 11 [ 4 group [ "f" unpack ] map ] }
{ 12 [ 8 group [ "d" unpack ] map ] }