Skip to content

Commit

Permalink
Clarify that a lone 1 weight as the implied weight is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
elasota committed Nov 9, 2023
1 parent 84c85b1 commit f4eeb99
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/zstd_compression_format.md
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 the only literal with `Weight` 1 is the implicit final weight (due to all
other values having a weight of 0), 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 f4eeb99

Please sign in to comment.