Lines Matching defs:code

28  *                      - Fix test code to correctly report unused input
37 #define MAXBITS 13 /* maximum code length */
97 * Huffman code decoding tables. count[1..MAXBITS] is the number of symbols of
98 * each length, which for a canonical code are stepped through in order.
109 * Decode a code from the stream s using huffman table h. Return the symbol or
111 * an empty code, or if the code is incomplete and an invalid code is received,
119 * build the code value reversed from what is in the stream in order to
122 * - The first code for the shortest length is all ones. Subsequent codes of
123 * the same length are simply integer decrements of the previous code. When
124 * moving up a length, a one bit is appended to the code. For a complete
125 * code, the last code of the longest length will be all zeros. To support
131 int len; /* current number of bits in code */
132 int code; /* len bits being decoded */
133 int first; /* first code of length len */
135 int index; /* index of first code of length len in symbol table */
142 code = first = index = 0;
147 code |= (bitbuf & 1) ^ 1; /* invert code */
150 if (code < first + count) { /* if length len, return symbol */
153 return h->symbol[index + (code - first)];
158 code <<= 1;
175 * Given a list of repeated code lengths rep[0..n-1], where each byte is a
176 * count (high four bits + 1) and a code length (low four bits), generate the
177 * list of code lengths. This compaction reduces the size of the object code.
178 * Then given the list of code lengths length[0..n-1] representing a canonical
179 * Huffman code for n symbols, construct the tables required to decode those
182 * return value is zero for a complete code set, negative for an over-
183 * subscribed code set, and positive for an incomplete code set. The tables
197 short length[256]; /* code lengths */
220 left = 1; /* one possible code of zero length */
250 * byte is 4, 5, or 6 for the number of extra bits in the distance code.
254 * terminated by an end code. Literals are either Huffman coded or
295 static struct huffman litcode = {litcnt, litsym}; /* length code */
296 static struct huffman lencode = {lencnt, lensym}; /* length code */
297 static struct huffman distcode = {distcnt, distsym};/* distance code */
335 if (len == 519) break; /* end code */
419 /* write any leftover output and update the error code if needed */
463 /* return blast() error code */