Lines Matching defs:length

37 #define MAXBITS 13              /* maximum code length */
98 * each length, which for a canonical code are stepped through in order.
104 short *count; /* number of symbols of each length */
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
133 int first; /* first code of length len */
134 int count; /* number of codes of length len */
135 int index; /* index of first code of length len in symbol table */
150 if (code < first + count) { /* if length len, return symbol */
155 index += count; /* else update for next length */
176 * count (high four bits + 1) and a code length (low four bits), generate the
178 * Then given the list of code lengths length[0..n-1] representing a canonical
180 * codes. Those tables are the number of codes of each length, and the symbols
181 * sorted by length, retaining their original order within each length. The
193 int symbol; /* current symbol when stepping through length[] */
194 int len; /* current length when stepping through h->count[] */
195 int left; /* number of possible codes left of current length */
196 short offs[MAXBITS+1]; /* offsets in symbol table for each length */
197 short length[256]; /* code lengths */
199 /* convert compact repeat counts into symbol bit length list */
206 length[symbol++] = len;
211 /* count number of codes of each length */
215 (h->count[length[symbol]])++; /* assumes lengths are within bounds */
220 left = 1; /* one possible code of zero length */
227 /* generate offsets into symbol table for each length for sorting */
233 * put symbols in table sorted by length, by symbol order within each
234 * length
237 if (length[symbol] != 0)
238 h->symbol[offs[length[symbol]]++] = symbol;
253 * - Compressed data is a combination of literals and length/distance pairs
255 * uncoded bytes. A length/distance pair is a coded length followed by a
259 * - A bit preceding a literal or length/distance pair indicates which comes
260 * next, 0 for literals, 1 for length/distance.
264 * no bit reversal is needed for either the length extra bits or the distance
267 * - Literal bytes are simply written to the output. A length/distance pair is
269 * copy is from distance bytes back in the output stream, copying for length
275 * - Overlapped copies, where the length is greater than the distance, are
276 * allowed and common. For example, a distance of one and a length of 518
277 * simply copies the last byte 518 times. A distance of four and a length of
279 * ignoring whether the length is greater than the distance or not implements
287 int len; /* length for copy */
295 static struct huffman litcode = {litcnt, litsym}; /* length code */
296 static struct huffman lencode = {lencnt, lensym}; /* length code */
306 /* bit lengths of length codes 0..15 */
310 static const short base[16] = { /* base for length codes */
312 static const char extra[16] = { /* extra bits for length codes */
329 /* decode literals and length/distance pairs */
332 /* get length */
345 /* copy length bytes from distance bytes back */