2.6.1 Converting Match Offset into Formatted Offset Values

The match offset, range [1..WINDOW_SIZE-3], is converted into a formatted offset by determining whether the offset can be encoded as a repeated offset, as shown in the following pseudocode. It is acceptable not to encode a match as a repeated offset even if it is possible to do so.

 if offset == R0 then
    formatted offset ←  0
 else if offset == R1 then
    formatted offset ←  1
 else if offset == R2 then
    formatted offset ←  2
 else
    formatted offset ←  offset + 2
 endif
Show: