add a word to make a sequence from a byte-array by taking n bits at a time

Doug Coleman 2009-06-03 21:21:51 -05:00
parent 9ba6f1205b
commit f35bfb6dba
1 changed files with 6 additions and 0 deletions

View File

@ -158,3 +158,9 @@ M: msb0-bit-reader peek ( n bs -- bits ) \ be> \ subseq>bits-be (peek) ;
writer bytes>> swap push writer bytes>> swap push
] unless ] unless
writer bytes>> ; writer bytes>> ;
:: byte-array-n>seq ( byte-array n -- seq )
byte-array length 8 * n / iota
byte-array <msb0-bit-reader> '[
drop n _ read
] { } map-as ;