41 const unsigned short *
base;
42 const unsigned short *
extra;
46 static const unsigned short lbase[31] = {
47 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
48 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
49 static const unsigned short lext[31] = {
50 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
51 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
52 static const unsigned short dbase[32] = {
53 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
54 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
55 8193, 12289, 16385, 24577, 0, 0};
56 static const unsigned short dext[32] = {
57 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
58 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
59 28, 28, 29, 29, 64, 64};
93 for (len = 0; len <=
MAXBITS; len++)
95 for (sym = 0; sym < codes; sym++)
100 for (max =
MAXBITS; max >= 1; max--)
101 if (count[max] != 0)
break;
102 if (root > max) root =
max;
104 this.
op = (
unsigned char)64;
105 this.bits = (
unsigned char)1;
112 for (min = 1; min <=
MAXBITS; min++)
113 if (count[min] != 0)
break;
114 if (root < min) root =
min;
118 for (len = 1; len <=
MAXBITS; len++) {
121 if (left < 0)
return -1;
123 if (left > 0 && (type ==
CODES || max != 1))
128 for (len = 1; len <
MAXBITS; len++)
129 offs[len + 1] = offs[len] + count[len];
132 for (sym = 0; sym < codes; sym++)
133 if (lens[sym] != 0) work[offs[lens[sym]]++] = (
unsigned short)sym;
193 low = (unsigned)(-1);
204 this.bits = (
unsigned char)(len - drop);
205 if ((
int)(work[sym]) < end) {
206 this.
op = (
unsigned char)0;
207 this.
val = work[sym];
209 else if ((
int)(work[sym]) > end) {
210 this.
op = (
unsigned char)(extra[work[sym]]);
211 this.
val = base[work[sym]];
214 this.
op = (
unsigned char)(32 + 64);
219 incr = 1
U << (len - drop);
224 next[(huff >> drop) + fill] =
this;
228 incr = 1
U << (len - 1);
240 if (--(count[len]) == 0) {
241 if (len == max)
break;
242 len = lens[work[sym]];
246 if (len > root && (huff & mask) !=
low) {
256 left = (
int)(1 << curr);
257 while (curr + drop < max) {
258 left -= count[curr + drop];
259 if (left <= 0)
break;
271 (*table)[
low].op = (
unsigned char)curr;
272 (*table)[
low].bits = (
unsigned char)root;
273 (*table)[
low].val = (
unsigned short)(next - *table);
284 this.
op = (
unsigned char)64;
285 this.bits = (
unsigned char)(len - drop);
289 if (drop != 0 && (huff & mask) !=
low) {
293 this.bits = (
unsigned char)len;
297 next[huff >> drop] =
this;
300 incr = 1
U << (len - 1);