make_huffman_decode_table(): entries_per_long
authorEric Biggers <ebiggers3@gmail.com>
Fri, 21 Dec 2012 04:34:35 +0000 (22:34 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 21 Dec 2012 04:34:35 +0000 (22:34 -0600)
src/decompress.c

index 6d4b41e2285512d33ad21e8a360a0d61931ca198..ebbf33e3e9b481f2c4d0fcbdaa8d4bbc5f07ceb6 100644 (file)
@@ -163,17 +163,15 @@ int make_huffman_decode_table(u16 decode_table[],  unsigned num_syms,
                        break;
 
                unsigned num_entries = 1 << (table_bits - codeword_len);
-               if (num_entries >=
-                       (sizeof(unsigned long) / sizeof(decode_table[0])))
-               {
-                       wimlib_assert2(decode_table_pos % 4 == 0);
+               const unsigned entries_per_long = sizeof(unsigned long) /
+                                                 sizeof(decode_table[0]);
+               if (num_entries >= entries_per_long) {
+                       wimlib_assert2(decode_table_pos % entries_per_long == 0);
                        BUILD_BUG_ON(sizeof(unsigned long) != 4 &&
                                     sizeof(unsigned long) != 8);
 
                        unsigned long *p = (unsigned long *)&decode_table[decode_table_pos];
-                       unsigned long n = num_entries /
-                                               (sizeof(unsigned long) /
-                                                       sizeof(decode_table[0]));
+                       unsigned n = num_entries / entries_per_long;
                        unsigned long v = sym;
                        if (sizeof(unsigned long) >= 4)
                                v |= v << 16;