Lines Matching defs:syms
125 syms: number of symbols remaining to code
131 syms: 3..totsym (totsym == total symbols to code)
132 left: 2..syms - 1, but only the evens (so syms == 8 -> 2, 4, 6)
135 syms == 2 is not saved since that immediately leads to a single code. left
138 ends at syms-1 since left == syms immediately results in a single code.
143 one (syms) being outermost, and the last one (len) being innermost. We build
144 the array with length max-1 lists for the len index, with syms-3 of those
156 to the num[] array as described above for the (syms, left, len) triplet.
237 local inline size_t map(int syms, int left, int len) {
238 return ((size_t)((syms - 1) >> 1) * ((syms - 2) >> 1) +
258 // through max inclusive, coding syms symbols, with left bit patterns of length
261 local big_t count(int syms, int left, int len) {
263 if (syms == left)
267 assert(syms > left && left > 0 && len < g.max);
270 size_t index = map(syms, left, len);
277 int least = (left << 1) - syms;
284 int most = (((code_t)left << (g.max - len)) - syms) /
290 got = count(syms - use, (left - use) << 1, len + 1);
305 // bit vector to indicate visiting this state. Each (syms,len,left) state has a
308 local int been_here(int syms, int left, int len, int mem, int rem) {
309 // point to vector for (syms,left,len), bit in vector for (mem,rem)
310 size_t index = map(syms, left, len);
357 // Examine all possible codes from the given node (syms, len, left). Compute
361 local void examine(int syms
363 if (syms == left) {
385 syms = 0;
388 syms += g.code[bits];
396 syms, g.root + 1, ((1 << g.root) - left) << 1);
409 if (been_here(syms, left, len, mem, rem))
414 int least = (left << 1) - syms;
421 int most = (((code_t)left << (g.max - len)) - syms) /
436 examine(syms - use, (left - use) << 1, len + 1,
450 // intermediate code states (syms, left, len). For each completed code,
454 local void enough(int syms) {
463 for (int n = 3; n <= syms; n++)
506 int syms = 286;
510 syms = atoi(argv[1]);
517 if (argc > 4 || syms < 2 || g.root < 1 || g.max < 1) {
523 // if not restricting the code length, the longest is syms - 1
524 if (g.max > syms - 1)
525 g.max = syms - 1;
533 if (g.max > bits || (code_t)(syms - 2) >= ((code_t)-1 >> (g.max - 1))) {
539 if ((code_t)(syms - 1) > ((code_t)1 << g.max) - 1) {
541 syms, g.max);
551 if (syms == 2) // iff max == 1
554 g.size = syms >> 1;
555 int n = (syms - 1) >> 1;
567 for (int n = 2; n <= syms; n++) {
572 printf("%"PRIbig" total codes for 2 to %d symbols", sum, syms);
573 if (g.max < syms - 1)
579 if (syms == 2)
589 if ((code_t)syms < ((code_t)1 << (g.root + 1)))
590 enough(syms);