Lines Matching defs:length
2 * all possible valid and complete prefix codes, subject to a length limit.
26 maximum code length in bits to determine the maximum table size for zlib's
30 length are not identical. So permutations of the symbol assignments result
35 are coded at each length. At each step, we have how many symbols remain to
36 be coded, what the last code length used was, and how many bit patterns of
37 that length remain unused. Then we add one to the code length and double the
38 number of unused patterns to graduate to the next code length. We then
39 assign all portions of the remaining symbols to that code length that
47 in length (root == 9 for literal/length codes and root == 6 for distance
54 prefix. If that longest code has length len, then the table has size 1 <<
58 of codes at each bit length is populated. When all of the codes are shorter
59 than root bits, then root is reduced to the longest code length, resulting
64 than root. In that case, root is increased to the length of the shortest
72 the maximum code length in bits. However this is a very small price to pay
80 codes of root bits or less in length.) Third, the visited states in the
93 and a large maximum code length, so multiple-precision arithmetic would need
99 remaining at the maximum length. This limits the maximum code length to the
119 size_t len; // allocated length of bit vector in octets
126 left: number of available bit patterns at length len
133 len: 1..max - 1 (max == maximum code length in bits)
137 the current length, which is double the number at the previous length. left
144 the array with length max-1 lists for the len index, with syms-3 of those
146 length as a function of sym. See the calculation of index in map() for the
173 // Type for a variable-length, allocated string.
177 size_t len; // length of string, not including terminating zero
225 int max; // maximum allowed bit length for the codes
231 int *code; // number of symbols assigned to each bit length
258 // through max inclusive, coding syms symbols, with left bit patterns of length
276 // incomplete at the next length (more bit patterns than symbols)
282 // available for the remaining symbols at the maximum length (if there were
283 // no limit to the code length, this would become: most = left - 1)
319 size_t length = g.done[index].len;
320 if (offset < length && (g.done[index].vec[offset] & bit) != 0)
326 if (length <= offset) {
329 if (length) {
331 length <<= 1;
332 } while (length <= offset);
333 vector = realloc(g.done[index].vec, length);
335 memset(vector + g.done[index].len, 0, length - g.done[index].len);
340 length = 16;
341 while (length <= offset)
342 length <<= 1;
343 vector = calloc(length, 1);
348 g.done[index].len = length;
413 // incomplete at the next length (more bit patterns than symbols)
419 // available for the remaining symbols at the maximum length (if there were
420 // no limit to the code length, this would become: most = left - 1)
484 // maximum number of symbols, initial root table size, and maximum code length
486 // are 286, 9, and 15 respectively, for the deflate literal/length code. The
493 // To count and examine prefix codes that are not length-limited, provide a
494 // maximum length equal to the number of symbols minus one.
496 // For the deflate literal/length code, use "enough". For the deflate distance
505 // get arguments -- default to the deflate literal/length code
523 // if not restricting the code length, the longest is syms - 1
534 fputs("abort: code length too long for internal types\n", stderr);
574 printf(" (%d-bit length limit)\n", g.max);
576 puts(" (no length limit)");
587 if (g.root > g.max) // reduce root to max length