Now that you've read RFC 1951, you should also look at puff.c in the
zlib distribution (in contrib/puff). It was written to unambiguously
define the deflate format by virtue of being a working deflate
decompressor that is easy to read and understand.
"Reversed" is relative to some initial expectation, so I will try to
answer the question in absolutes.
Starting with the block descriptor, those three bits are the low three
bits of the first byte. The lowest bit (bit 0) is BFINAL. The next
two bits (bits 1 and 2) are BTYPE. BTYPE appears as a two-bit integer
with the least significant bit in the lowest (bit 1) position.
So a final static block has the low three bits: 011, i.e. starting
with the byte xxxxx011. A non-final dynamic block has the low three
bits 100 (staring byte xxxxx100).
All other integer (multi-bit) values in the format are stored the same
way. Bits are pulled and masked from the low end of the byte, and are
then treated as an integer with the least significant bit of the
integer in the least significant position in the extracted bits.
Huffman codes however are stored with the most significant bit in the
least significant position. So if you have a Huffman code like this:
Then the sequence CAB will look like:
which you start reading from the bottom. So it is .