Robert Rohde wrote:
On Thu, Mar 26, 2009 at 12:09 PM, Ilmari Karonen nospam@vyznev.net wrote:
Hmm? Admittedly, I don't know the bzip2 format very well, but as far as I understand it, there should be no bit-shifting involved: each block in the stream is a completely independent, self-contained sequence of bytes.
I believe the point is that each block is a self-contained sequence of bits not bytes, so a block can terminate in the middle of a byte. The next block is appended immediately (if I understand correctly), so block boundaries do not necessarily align to byte boundaries. Hence the need to do bit shifting.
The Wikipedia article (what else?) on the format says the blocks are padded to byte boundaries, and some quick testing seems to support that.