From b38d87b476b804d7948928d298c784deb875a93c Mon Sep 17 00:00:00 2001 From: elasota <ejlasota@gmail.com> Date: Tue, 31 Oct 2023 01:17:23 -0400 Subject: [PATCH 1/2] Clarify that the log2 of the largest possible symbol is the maximum number of bits consumed --- doc/zstd_compression_format.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/zstd_compression_format.md b/doc/zstd_compression_format.md index cd7308de196..7b29ccec648 100644 --- a/doc/zstd_compression_format.md +++ b/doc/zstd_compression_format.md @@ -1083,7 +1083,7 @@ It depends on : Presuming an `Accuracy_Log` of 8, and presuming 100 probabilities points have already been distributed, the decoder may read any value from `0` to `256 - 100 + 1 == 157` (inclusive). - Therefore, it must read `log2sup(157) == 8` bits. + Therefore, it may read up to `log2sup(157) == 8` bits. - Value decoded : small values use 1 less bit : __example__ : From 324cce4996d24af7b2cd86cf5eb1b9bd80de0a47 Mon Sep 17 00:00:00 2001 From: elasota <ejlasota@gmail.com> Date: Tue, 31 Oct 2023 11:42:00 -0400 Subject: [PATCH 2/2] Add definition of "log2sup" function --- doc/zstd_compression_format.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/zstd_compression_format.md b/doc/zstd_compression_format.md index 7b29ccec648..0532a846f45 100644 --- a/doc/zstd_compression_format.md +++ b/doc/zstd_compression_format.md @@ -1083,7 +1083,8 @@ It depends on : Presuming an `Accuracy_Log` of 8, and presuming 100 probabilities points have already been distributed, the decoder may read any value from `0` to `256 - 100 + 1 == 157` (inclusive). - Therefore, it may read up to `log2sup(157) == 8` bits. + Therefore, it may read up to `log2sup(157) == 8` bits, where `log2sup(N)` + is the smallest integer `T` that satisfies `(1 << T) > N`. - Value decoded : small values use 1 less bit : __example__ :