Lines Matching defs:code
31 #define MAXBITS 13 /* maximum code length */
91 * Huffman code decoding tables. count[1..MAXBITS] is the number of symbols of
92 * each length, which for a canonical code are stepped through in order.
103 * Decode a code from the stream s using huffman table h. Return the symbol or
105 * an empty code, or if the code is incomplete and an invalid code is received,
113 * build the code value reversed from what is in the stream in order to
116 * - The first code for the shortest length is all ones. Subsequent codes of
117 * the same length are simply integer decrements of the previous code. When
118 * moving up a length, a one bit is appended to the code. For a complete
119 * code, the last code of the longest length will be all zeros. To support
125 int len; /* current number of bits in code */
126 int code; /* len bits being decoded */
127 int first; /* first code of length len */
129 int index; /* index of first code of length len in symbol table */
136 code = first = index = 0;
141 code |= (bitbuf & 1) ^ 1; /* invert code */
144 if (code < first + count) { /* if length len, return symbol */
147 return h->symbol[index + (code - first)];
152 code <<= 1;
169 * Given a list of repeated code lengths rep[0..n-1], where each byte is a
170 * count (high four bits + 1) and a code length (low four bits), generate the
171 * list of code lengths. This compaction reduces the size of the object code.
172 * Then given the list of code lengths length[0..n-1] representing a canonical
173 * Huffman code for n symbols, construct the tables required to decode those
176 * return value is zero for a complete code set, negative for an over-
177 * subscribed code set, and positive for an incomplete code set. The tables
191 short length[256]; /* code lengths */
214 left = 1; /* one possible code of zero length */
244 * byte is 4, 5, or 6 for the number of extra bits in the distance code.
248 * terminated by an end code. Literals are either Huffman coded or
289 static struct huffman litcode = {litcnt, litsym}; /* length code */
290 static struct huffman lencode = {lencnt, lensym}; /* length code */
291 static struct huffman distcode = {distcnt, distsym};/* distance code */
329 if (len == 519) break; /* end code */
401 /* write any leftover output and update the error code if needed */
441 /* return blast() error code */