Skip to content

Commit

Permalink
Clarify that there must be at least 2 weights, i.e. encoding all weig…
Browse files Browse the repository at this point in the history
…hts as 0 is invalid
  • Loading branch information
elasota authored and terrelln committed Nov 24, 2023
1 parent dc84e35 commit 05059e5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/zstd_compression_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,9 @@ Number_of_Bits = Weight ? (Max_Number_of_Bits + 1 - Weight) : 0
```
When a literal value is not present, it receives a `Weight` of 0.
The least frequent symbol receives a `Weight` of 1.
If no symbol has a `Weight` of 1, then the data is considered corrupted.
If no literal has a `Weight` of 1, then the data is considered corrupted.
If there are not at least two literals with non-zero `Weight`, then the data
is considered corrupted.
The most frequent symbol receives a `Weight` anywhere between 1 and 11 (max).
The last symbol's `Weight` is deduced from previously retrieved Weights,
by completing to the nearest power of 2. It's necessarily non 0.
Expand Down

0 comments on commit 05059e5

Please sign in to comment.