diff options
Diffstat (limited to 'thirdparty/brotli/dec/huffman.c')
-rw-r--r-- | thirdparty/brotli/dec/huffman.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/thirdparty/brotli/dec/huffman.c b/thirdparty/brotli/dec/huffman.c index 8f127d7b6f..3806454864 100644 --- a/thirdparty/brotli/dec/huffman.c +++ b/thirdparty/brotli/dec/huffman.c @@ -10,9 +10,10 @@ #include <string.h> /* memcpy, memset */ +#include <brotli/types.h> + #include "../common/constants.h" #include "../common/platform.h" -#include <brotli/types.h> #if defined(__cplusplus) || defined(c_plusplus) extern "C" { @@ -117,11 +118,13 @@ void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* table, int bits_count; BROTLI_DCHECK(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH <= BROTLI_REVERSE_BITS_MAX); + BROTLI_DCHECK(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH == 5); /* Generate offsets into sorted symbol table by code length. */ symbol = -1; bits = 1; - BROTLI_REPEAT(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH, { + /* BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH == 5 */ + BROTLI_REPEAT_5({ symbol += count[bits]; offset[bits] = symbol; bits++; @@ -132,7 +135,7 @@ void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* table, /* Sort symbols by length, by symbol order within each length. */ symbol = BROTLI_CODE_LENGTH_CODES; do { - BROTLI_REPEAT(6, { + BROTLI_REPEAT_6({ symbol--; sorted[offset[code_lengths[symbol]]--] = symbol; }); |