adjust-bits ( n bs -- )


Vocabulary
bitstreams

Inputs
nan object
bsan object


Outputs
None

Definition


:: adjust-bits ( n bs -- )
n 8 /mod :> ( #bytes #bits ) bs [ #bytes + ] change-byte-pos
bit-pos>> #bits + dup 8 >=
[ 8 - bs bit-pos<< bs [ 1 + ] change-byte-pos drop ]
[ bs bit-pos<< ] if ;