2.4.1.3.6 Compression algorithm

The pseudocode for the Compression algorithm uses the state variables described in State Variables (section 2.4.1.2): DecompressedCurrent, DecompressedBufferEnd, and CompressedCurrent. These state variables MUST be initialized by the caller. CompressedChunkStart and DecompressedChunkStart are also used.

 SET SignatureByte TO 0x01 
  
 INCREMENT CompressedCurrent
  
 WHILE DecompressedCurrent is LESS THAN DecompressedBufferEnd
  
    SET CompressedChunkStart TO CompressedCurrent
  
    SET DecompressedChunkStart TO DecompressedCurrent
  
    CALL Compressing a DecompressedChunk (section 2.4.1.3.7)
  
 END WHILE