From c0467e56d5696314e11d303c9591e37f86ca2620 Mon Sep 17 00:00:00 2001 From: Roy Oursler Date: Fri, 14 Dec 2018 09:25:12 -0700 Subject: [PATCH] igzip: Use blind union to represent overlapped tables in hufftables_icf Change-Id: I0260a705db81f4e7731d4d40757c5919be002e8f Signed-off-by: Roy Oursler --- igzip/encode_df.c | 2 +- igzip/huff_codes.h | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/igzip/encode_df.c b/igzip/encode_df.c index a3ce929..d26d1c9 100644 --- a/igzip/encode_df.c +++ b/igzip/encode_df.c @@ -23,7 +23,7 @@ struct deflate_icf *encode_deflate_icf_base(struct deflate_icf *next_in, while (next_in < end_in && !is_full(bb)) { lsym = hufftables->lit_len_table[next_in->lit_len]; - dsym = hufftables->dist_table[next_in->lit_dist]; + dsym = hufftables->dist_lit_table[next_in->lit_dist]; // insert ll code, dist_code, and extra_bits write_bits_unsafe(bb, lsym.code_and_extra, lsym.length); diff --git a/igzip/huff_codes.h b/igzip/huff_codes.h index f219135..d353d27 100644 --- a/igzip/huff_codes.h +++ b/igzip/huff_codes.h @@ -138,8 +138,17 @@ struct rl_code { }; struct hufftables_icf { - struct huff_code dist_table[31]; - struct huff_code lit_len_table[513]; + union { + struct { + struct huff_code dist_lit_table[288]; + struct huff_code len_table[256]; + }; + + struct { + struct huff_code dist_table[31]; + struct huff_code lit_len_table[513]; + }; + }; }; /**