Skip to content

Commit 68e6634

Browse files
committed
don't emit empty penultimate metadata block unless needed
1 parent 07e478b commit 68e6634

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/enc/encode.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,8 @@ fn WriteMetaBlockInternal<Alloc: BrotliAlloc,
20202020
false,
20212021
cb);
20222022
if actual_is_last != is_last {
2023-
if params.byte_align {
2023+
// insert empty block for byte alignment if required
2024+
if params.byte_align && ((*storage_ix & 7u32 as (usize)) != 0) {
20242025
BrotliStoreSyncMetaBlock(storage_ix, storage);
20252026
}
20262027
BrotliWriteEmptyLastMetaBlock(storage_ix, storage)
@@ -2163,7 +2164,8 @@ fn WriteMetaBlockInternal<Alloc: BrotliAlloc,
21632164
cb);
21642165
}
21652166
if actual_is_last != is_last {
2166-
if params.byte_align {
2167+
// insert empty block for byte alignment if required
2168+
if params.byte_align && ((*storage_ix & 7u32 as (usize)) != 0) {
21672169
BrotliStoreSyncMetaBlock(storage_ix, storage);
21682170
}
21692171
BrotliWriteEmptyLastMetaBlock(storage_ix, storage)

0 commit comments

Comments
 (0)