Formats - The format of a packed file MegaLZ.

Info Guide #10
     The format of a packed file MegaLZ

Lord Vader


   The first byte is copied into vyhod.Vtoroy -
is in bits.

   Bits in a byte of bits - from the senior.

   If you want a bit, but it is not (all 8 to
nchilis) - a new byte is selected from at
current. From the same selected and bytes, denoted
obtained  - but only after the sample
all the bits link.

   The format options:  - byte, which
ry is selected from the stream.

1  -  copied to the output.
000abc - copy an old byte

         shift FFF8 + [abc] to current

         position in the output

         (Abc == 000 - offset FFF8,

         abc == 111 - FFFF)
001  - copy 2 bytes at offset

           FF00 +  (-1 ..- 256)
0100  - copy 3 bytes of

           shift FF00 + 
0101abcd  - copy 3 bytes of

           shift (F [abcd] -1) * 256 + 

           (-257 ..- 4352)


   Longer links can be conveniently represented
in the form of 3 parts:


   Prefix:
011


   The length of the links:
1a -> 4 + [a]
01ab -> 6 + [ab]
001abc -> 10 + [abc]
0001abcd -> 18 + [abcd]
00001abcde -> 34 + [abcde]
000001abcdef -> 66 + [abcdef]
 0000001abcdefg -> 130 + [abcdefg] (here the length

                            no more than 255!)


   Displacement:
0  - FF00 +  ago (-1 ..- 256)
1abcd  - (F [abcd] -1) * 256 + 

                             (-257 ..- 4352)


   The label end of the stream:
011000000001


                 Examples:

000,111 - to repeat the last byte
 001  - repeat the last byte

             double (offset =- 1, length 2)

 011 001101 10000  - link length

      % 101 +10 = 15 bytes at offset -4352