Author: Stan Eisenstat
Subject: Re: [Cs323] None
Date: Sunday, 01 Nov 2020, 18:09:16
> Message Posted By: Unknown
>
> If we have NBITS as 9, when doing PUTBITS(NBITS, code), does the lowest
> order bit get moved to the next byte?
Yes, as I posted yesterday:
Subject: Re: [Cs323] flushBits
> Message Posted By: Unknown
>
> When do you need to call flushBits()?
Suppose that stdin contains one character, and that
encode is running in Stage 3 and has assigned a code to
the empty string. Then encode will call putBits() to
write one 9-bit code to stdout. putBits() can only
output the high-order 8 bits of this code and thus must
save the low-order bit for the next call. But unless
encode calls flushBits() (or does something equivalent),
there will not be a next call and the low-order bit will
never be output.
--Stan-
PREV
INDEX
NEXT