From 8c7923045a76e9a2baeddf6746a5c909497fb84a Mon Sep 17 00:00:00 2001 From: Evgenii Kliuchnikov Date: Wed, 9 Aug 2023 02:48:12 -0700 Subject: reduce amount of padding in decoder structs PiperOrigin-RevId: 555101669 --- c/dec/decode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'c/dec/decode.c') 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); -- cgit v1.1