* approximately (with the algorithm used here) the minimum weighted path
* length from the root, given this constraint.
*
- * A canonical Huffman code satisfies the properties that a codeword
- * never lexicographically precedes a shorter codeword, and the
+ * A canonical Huffman code satisfies the properties that a longer
+ * codeword never lexicographically precedes a shorter codeword, and the
* lexicographic ordering of codewords of the same length is the same as
* the lexicographic ordering of the corresponding symbols. A canonical
* Huffman code, or more generally a canonical prefix code, can be
/* Assumptions */
wimlib_assert2(num_syms >= 2);
wimlib_assert2(num_syms <= (1 << NUM_SYMBOL_BITS));
- wimlib_assert2(max_codeword_len > 0);
+ wimlib_assert2((1ULL << max_codeword_len) >= num_syms);
wimlib_assert2(max_codeword_len <= 32);
/* We begin by sorting the symbols primarily by frequency and