3.1.8.1.4.3.2.1 Examples of Length-of-Match Encoding

  1. Encoding a length-of-match of 2 bytes.

     LUTIndex = 0
     HuffmanCode = 0x0001
     OutputBits(0x0001, 4) = bin:0001
      
     ExtraBitsLength = 0
     No extra bits to output
    
  2. Encoding a length-of-match of 117 bytes.

     LUTIndex = 23
     HuffmanCode = 0x01df
     OutputBits(0x01df, 9) = bin:111011111
      
     ExtraBitsLength = 4
     ExtraBits = (117 - 2) & ((2 ^ 4) - 1) = 115 & 15 = bin:1110011 & bin:1111 = 3
     OutputBits(0x03, 4) = bin:0011