Lines Matching refs:syms
119 syms: number of symbols remaining to code
125 syms: 3..totsym (totsym == total symbols to code)
126 left: 2..syms - 1, but only the evens (so syms == 8 -> 2, 4, 6)
129 syms == 2 is not saved since that immediately leads to a single code. left
132 left ends at syms-1 since left == syms immediately results in a single code.
137 first one (syms) being outermost, and the last one (len) being innermost.
138 We build the array with length max-1 lists for the len index, with syms-3
151 to the num[] array as described above for the (syms, left, len) triplet.
199 len through max inclusive, coding syms symbols, with left bit patterns of
203 local big_t count(int syms, int len, int left)
207 int least; /* least number of syms to use at this juncture */
208 int most; /* most number of syms to use at this juncture */
213 if (syms == left)
217 assert(syms > left && left > 0 && len < max);
220 index = INDEX(syms, left, len);
227 least = (left << 1) - syms;
234 most = (((code_t)left << (max - len)) - syms) /
240 got = count(syms - use, len + 1, (left - use) << 1);
255 bit vector to indicate visiting this state. Each (syms,len,left) state
258 local int beenhere(int syms, int len, int left, int mem, int rem)
266 /* point to vector for (syms,left,len), bit in vector for (mem,rem) */
267 index = INDEX(syms, left, len);
317 /* Examine all possible codes from the given node (syms, len, left). Compute
322 local void examine(int syms, int len, int left, int mem, int rem)
324 int least; /* least number of syms to use at this juncture */
325 int most; /* most number of syms to use at this juncture */
329 if (syms == left) {
358 if (beenhere(syms, len, left, mem, rem))
363 least = (left << 1) - syms;
370 most = (((code_t)left << (max - len)) - syms) /
385 examine(syms - use, len + 1, (left - use) << 1,
399 intermediate code states (syms, left, len). For each completed code,
403 local void enough(int syms)
416 for (n = 3; n <= syms; n++)
460 int syms; /* total number of symbols to code */
472 syms = 286;
476 syms = atoi(argv[1]);
483 if (argc > 4 || syms < 2 || root < 1 || max < 1) {
489 /* if not restricting the code length, the longest is syms - 1 */
490 if (max > syms - 1)
491 max = syms - 1;
498 if (max > n || (code_t)(syms - 2) >= (((code_t)0 - 1) >> (max - 1))) {
504 if ((code_t)(syms - 1) > ((code_t)1 << max) - 1) {
506 syms, max);
519 if (syms == 2) /* iff max == 1 */
522 size = syms >> 1;
523 if (size > ((size_t)0 - 1) / (n = (syms - 1) >> 1) ||
535 for (n = 2; n <= syms; n++) {
545 printf("%llu total codes for 2 to %d symbols", sum, syms);
546 if (max < syms - 1)
552 if (syms == 2)
564 if ((code_t)syms < ((code_t)1 << (root + 1)))
565 enough(syms);