81 register unsigned short sym, next_symbol;
82 register unsigned int leaf, fill;
86 register unsigned char bit_num;
88 unsigned int table_mask = 1 << nbits;
89 unsigned int bit_mask = table_mask >> 1;
92 for (bit_num = 1; bit_num <= nbits; bit_num++) {
93 for (sym = 0; sym < nsyms; sym++) {
94 if (
length[sym] != bit_num)
continue;
100 do {leaf <<= 1; leaf |= reverse & 1; reverse >>= 1;}
while (--fill);
106 #ifdef BITS_ORDER_MSB
107 for (fill =
bit_mask; fill-- > 0;) table[leaf++] = sym;
109 fill =
bit_mask; next_symbol = 1 << bit_num;
110 do { table[leaf] = sym; leaf += next_symbol; }
while (--fill);
117 if (
pos == table_mask)
return 0;
120 for (sym =
pos; sym < table_mask; sym++) {
121 #ifdef BITS_ORDER_MSB
124 reverse = sym; leaf = 0; fill = nbits;
125 do { leaf <<= 1; leaf |= reverse & 1; reverse >>= 1; }
while (--fill);
126 table[leaf] = 0xFFFF;
131 next_symbol = ((table_mask >> 1) < nsyms) ? nsyms : (table_mask >> 1);
139 for (bit_num = nbits+1; bit_num <=
HUFF_MAXBITS; bit_num++) {
140 for (sym = 0; sym < nsyms; sym++) {
141 if (
length[sym] != bit_num)
continue;
142 if (
pos >= table_mask)
return 1;
144 #ifdef BITS_ORDER_MSB
149 do {leaf <<= 1; leaf |= reverse & 1; reverse >>= 1;}
while (--fill);
151 for (fill = 0; fill < (bit_num - nbits); fill++) {
153 if (table[leaf] == 0xFFFF) {
154 table[(next_symbol << 1) ] = 0xFFFF;
155 table[(next_symbol << 1) + 1 ] = 0xFFFF;
156 table[leaf] = next_symbol++;
160 leaf = table[leaf] << 1;
161 if ((
pos >> (15-fill)) & 1) leaf++;
170 return (
pos == table_mask) ? 0 : 1;
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length