Don't reverse the bits except for Huffman codes, and only then if your decoding approach requires it. zlib's inflate never reverses the bits. puff reserves bits only to decode Huffman codes. You will get confused if you try to interpret all of the bits reversed, and you will have to un-reverse offset bits.
Just read the bits from the bottom.
In your example, 11101101
, the bottom bit is 1
indicating that this first block is also the last block. The next two bits (not reversed) 10
says that it is a dynamic block.
You can use puff.c
, in the contrib/puff
directory in the zlib distribution, as a supplement to RFC 1951. puff.c
was written to be a simple and clear implementation of inflate to provide an unambiguous definition of the deflate format.