aboutsummaryrefslogtreecommitdiff
path: root/c/dec/decode.c
diff options
context:
space:
mode:
authorEvgenii Kliuchnikov <eustas@google.com>2023-08-09 02:48:12 -0700
committerCopybara-Service <copybara-worker@google.com>2023-08-09 02:48:53 -0700
commit8c7923045a76e9a2baeddf6746a5c909497fb84a (patch)
tree49bb60c8a4afa7c1d86e3018f273522d8588a309 /c/dec/decode.c
parenta560089843ad59f41315b7cf8b11632c510f73a9 (diff)
downloadbrotli-8c7923045a76e9a2baeddf6746a5c909497fb84a.zip
brotli-8c7923045a76e9a2baeddf6746a5c909497fb84a.tar.gz
brotli-8c7923045a76e9a2baeddf6746a5c909497fb84a.tar.bz2
reduce amount of padding in decoder structs
PiperOrigin-RevId: 555101669
Diffstat (limited to 'c/dec/decode.c')
-rw-r--r--c/dec/decode.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/c/dec/decode.c b/c/dec/decode.c
index 953523f..220c7e8 100644
--- a/c/dec/decode.c
+++ b/c/dec/decode.c
@@ -149,7 +149,7 @@ static BrotliDecoderErrorCode DecodeWindowBits(BrotliDecoderState* s,
}
BrotliTakeBits(br, 3, &n);
if (n != 0) {
- s->window_bits = 17 + n;
+ s->window_bits = (17u + n) & 63u;
return BROTLI_DECODER_SUCCESS;
}
BrotliTakeBits(br, 3, &n);
@@ -166,7 +166,7 @@ static BrotliDecoderErrorCode DecodeWindowBits(BrotliDecoderState* s,
}
}
if (n != 0) {
- s->window_bits = 8 + n;
+ s->window_bits = (8u + n) & 63u;
return BROTLI_DECODER_SUCCESS;
}
s->window_bits = 17;
@@ -2422,7 +2422,7 @@ BrotliDecoderResult BrotliDecoderDecompressStream(
result = BROTLI_DECODER_NEEDS_MORE_INPUT;
break;
}
- s->window_bits = (brotli_reg_t)bits;
+ s->window_bits = bits & 63u;
if (s->window_bits < BROTLI_LARGE_MIN_WBITS ||
s->window_bits > BROTLI_LARGE_MAX_WBITS) {
result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS);