From c7942caff083f8c76085208c8a34812c337ad820 Mon Sep 17 00:00:00 2001 From: Ulrich Kunitz Date: Mon, 22 Oct 2018 23:46:43 +0200 Subject: [PATCH] Clarify special case of offset history update If the current sequence has literal length of zero then an offset value of three is handled in a special manner. While I implemented a golang decoder I had to consult the educational decoder for clarification on the update of the offset history in that case. This commit provides the clarification that the offset value Repeated_Offset1-1 is handled as a new offset is added to the offset history accordingly. --- doc/zstd_compression_format.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/zstd_compression_format.md b/doc/zstd_compression_format.md index e562e628b..eacf76252 100644 --- a/doc/zstd_compression_format.md +++ b/doc/zstd_compression_format.md @@ -919,6 +919,10 @@ This means that when `Repeated_Offset1` (most recent) is used, history is unmodi When `Repeated_Offset2` is used, it's swapped with `Repeated_Offset1`. If any other offset is used, it becomes `Repeated_Offset1` and the rest are shift back by one. +In the case of an `offset_value` of 3 and the literal length of the current +sequence is zero the value `Repeasted_Offset1 - 1_byte` is a new offset, +becoming the lead of the offset history and the first two repeated offsets will +be shifted back. Skippable Frames ----------------