Fix emitting 1-byte long metadata block

PiperOrigin-RevId: 505484299
This commit is contained in:
Evgenii Kliuchnikov 2023-01-29 14:16:20 +00:00 committed by Evgenii Kliuchnikov
parent 1e61e972fb
commit 04f294b18a

View File

@ -1188,7 +1188,7 @@ static size_t WriteMetadataHeader(
if (block_size == 0) {
BrotliWriteBits(2, 0, &storage_ix, header);
} else {
uint32_t nbits = (block_size == 1) ? 0 :
uint32_t nbits = (block_size == 1) ? 1 :
(Log2FloorNonZero((uint32_t)block_size - 1) + 1);
uint32_t nbytes = (nbits + 7) / 8;
BrotliWriteBits(2, nbytes, &storage_ix, header);