From 60d9a30f4e421a03b87cac03bf6e0b31d3363362 Mon Sep 17 00:00:00 2001 From: Roy Oursler Date: Tue, 12 Jul 2016 15:00:44 -0700 Subject: [PATCH] igzip: Rename small_code_lookup Rename small_code_lookup to short_code_lookup to match naming of long_code_lookup. Signed-off-by: Roy Oursler Reviewed-by: Greg Tucker --- igzip/igzip_inflate.c | 48 +++++++++++++++++++++---------------------- include/inflate.h | 4 ++-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/igzip/igzip_inflate.c b/igzip/igzip_inflate.c index e818a2e..d2bfd15 100644 --- a/igzip/igzip_inflate.c +++ b/igzip/igzip_inflate.c @@ -142,7 +142,7 @@ void inline make_inflate_huff_code_large(struct inflate_huff_code_large *result, uint32_t insert_index; uint32_t last_length; uint32_t copy_size; - uint16_t *small_code_lookup = result->small_code_lookup; + uint16_t *short_code_lookup = result->short_code_lookup; count_total[0] = 0; count_total[1] = 0; @@ -172,8 +172,8 @@ void inline make_inflate_huff_code_large(struct inflate_huff_code_large *result, break; while (huff_code_table[i].length > last_length) { - memcpy(small_code_lookup + copy_size, small_code_lookup, - sizeof(*small_code_lookup) * copy_size); + memcpy(short_code_lookup + copy_size, short_code_lookup, + sizeof(*short_code_lookup) * copy_size); last_length++; copy_size <<= 1; } @@ -189,14 +189,14 @@ void inline make_inflate_huff_code_large(struct inflate_huff_code_large *result, * address are the same as the code for the current symbol. The * first 9 bits are the code, bits 14:10 are the code length, * bit 15 is a flag representing this is a symbol*/ - small_code_lookup[huff_code_table[i].code] = + short_code_lookup[huff_code_table[i].code] = i | (huff_code_table[i].length) << 9; } while (DECODE_LOOKUP_SIZE_LARGE > last_length) { - memcpy(small_code_lookup + copy_size, small_code_lookup, - sizeof(*small_code_lookup) * copy_size); + memcpy(short_code_lookup + copy_size, short_code_lookup, + sizeof(*short_code_lookup) * copy_size); last_length++; copy_size <<= 1; } @@ -224,8 +224,8 @@ void inline make_inflate_huff_code_large(struct inflate_huff_code_large *result, max_length = huff_code_table[long_code_list[i]].length; first_bits = - huff_code_table[long_code_list[i]]. - code & ((1 << DECODE_LOOKUP_SIZE_LARGE) - 1); + huff_code_table[long_code_list[i]].code + & ((1 << DECODE_LOOKUP_SIZE_LARGE) - 1); temp_code_list[0] = long_code_list[i]; temp_code_length = 1; @@ -243,8 +243,8 @@ void inline make_inflate_huff_code_large(struct inflate_huff_code_large *result, for (j = 0; j < temp_code_length; j++) { code_length = huff_code_table[temp_code_list[j]].length; long_bits = - huff_code_table[temp_code_list[j]]. - code >> DECODE_LOOKUP_SIZE_LARGE; + huff_code_table[temp_code_list[j]].code >> + DECODE_LOOKUP_SIZE_LARGE; min_increment = 1 << (code_length - DECODE_LOOKUP_SIZE_LARGE); for (; long_bits < (1 << (max_length - DECODE_LOOKUP_SIZE_LARGE)); long_bits += min_increment) { @@ -253,7 +253,7 @@ void inline make_inflate_huff_code_large(struct inflate_huff_code_large *result, } huff_code_table[temp_code_list[j]].code = 0xFFFF; } - result->small_code_lookup[first_bits] = + result->short_code_lookup[first_bits] = long_code_lookup_length | (max_length << 9) | 0x8000; long_code_lookup_length += 1 << (max_length - DECODE_LOOKUP_SIZE_LARGE); @@ -283,7 +283,7 @@ void inline make_inflate_huff_code_small(struct inflate_huff_code_small *result, uint32_t insert_index; uint32_t last_length; uint32_t copy_size; - uint16_t *small_code_lookup = result->small_code_lookup; + uint16_t *short_code_lookup = result->short_code_lookup; count_total[0] = 0; count_total[1] = 0; @@ -313,8 +313,8 @@ void inline make_inflate_huff_code_small(struct inflate_huff_code_small *result, break; while (huff_code_table[i].length > last_length) { - memcpy(small_code_lookup + copy_size, small_code_lookup, - sizeof(*small_code_lookup) * copy_size); + memcpy(short_code_lookup + copy_size, short_code_lookup, + sizeof(*short_code_lookup) * copy_size); last_length++; copy_size <<= 1; } @@ -330,14 +330,14 @@ void inline make_inflate_huff_code_small(struct inflate_huff_code_small *result, * address are the same as the code for the current symbol. The * first 9 bits are the code, bits 14:10 are the code length, * bit 15 is a flag representing this is a symbol*/ - small_code_lookup[huff_code_table[i].code] = + short_code_lookup[huff_code_table[i].code] = i | (huff_code_table[i].length) << 9; } while (DECODE_LOOKUP_SIZE_SMALL > last_length) { - memcpy(small_code_lookup + copy_size, small_code_lookup, - sizeof(*small_code_lookup) * copy_size); + memcpy(short_code_lookup + copy_size, short_code_lookup, + sizeof(*short_code_lookup) * copy_size); last_length++; copy_size <<= 1; } @@ -365,8 +365,8 @@ void inline make_inflate_huff_code_small(struct inflate_huff_code_small *result, max_length = huff_code_table[long_code_list[i]].length; first_bits = - huff_code_table[long_code_list[i]]. - code & ((1 << DECODE_LOOKUP_SIZE_SMALL) - 1); + huff_code_table[long_code_list[i]].code + & ((1 << DECODE_LOOKUP_SIZE_SMALL) - 1); temp_code_list[0] = long_code_list[i]; temp_code_length = 1; @@ -384,8 +384,8 @@ void inline make_inflate_huff_code_small(struct inflate_huff_code_small *result, for (j = 0; j < temp_code_length; j++) { code_length = huff_code_table[temp_code_list[j]].length; long_bits = - huff_code_table[temp_code_list[j]]. - code >> DECODE_LOOKUP_SIZE_SMALL; + huff_code_table[temp_code_list[j]].code >> + DECODE_LOOKUP_SIZE_SMALL; min_increment = 1 << (code_length - DECODE_LOOKUP_SIZE_SMALL); for (; long_bits < (1 << (max_length - DECODE_LOOKUP_SIZE_SMALL)); long_bits += min_increment) { @@ -394,7 +394,7 @@ void inline make_inflate_huff_code_small(struct inflate_huff_code_small *result, } huff_code_table[temp_code_list[j]].code = 0xFFFF; } - result->small_code_lookup[first_bits] = + result->short_code_lookup[first_bits] = long_code_lookup_length | (max_length << 9) | 0x8000; long_code_lookup_length += 1 << (max_length - DECODE_LOOKUP_SIZE_SMALL); @@ -469,7 +469,7 @@ uint16_t inline decode_next_large(struct inflate_state *state, * a symbol, it provides a hint of where the large symbols containin * this code are located. Note the hint is at largest the location the * first actual symbol in the long code list.*/ - next_sym = huff_code->small_code_lookup[next_bits]; + next_sym = huff_code->short_code_lookup[next_bits]; if (next_sym < 0x8000) { /* Return symbol found if next_code is a complete huffman code @@ -518,7 +518,7 @@ uint16_t inline decode_next_small(struct inflate_state *state, * a symbol, it provides a hint of where the large symbols containin * this code are located. Note the hint is at largest the location the * first actual symbol in the long code list.*/ - next_sym = huff_code->small_code_lookup[next_bits]; + next_sym = huff_code->short_code_lookup[next_bits]; if (next_sym < 0x8000) { /* Return symbol found if next_code is a complete huffman code diff --git a/include/inflate.h b/include/inflate.h index df67be5..2209c28 100644 --- a/include/inflate.h +++ b/include/inflate.h @@ -63,13 +63,13 @@ */ struct inflate_huff_code_large{ - uint16_t small_code_lookup[ 1 << (DECODE_LOOKUP_SIZE_LARGE)]; + uint16_t short_code_lookup[ 1 << (DECODE_LOOKUP_SIZE_LARGE)]; uint16_t long_code_lookup[288 + (1 << (15 - DECODE_LOOKUP_SIZE_LARGE))]; }; struct inflate_huff_code_small{ - uint16_t small_code_lookup[ 1 << (DECODE_LOOKUP_SIZE_SMALL)]; + uint16_t short_code_lookup[ 1 << (DECODE_LOOKUP_SIZE_SMALL)]; uint16_t long_code_lookup[32 + (1 << (15 - DECODE_LOOKUP_SIZE_SMALL))]; };