Skip to content
Permalink
Browse files
Inflate: use one shift for both huffman code and extra bits (~5.5% sp…
…eedup)

This changes the "code" structure so that "bits" contains the total
number of bits, and "op & 15" contains the non-extra bit count.

The inffast*.c implementations save the unshifted bit-buffer and
extract the extra bits from that, whereas inflate.c simply converts
the values back to the old format.
  • Loading branch information
dougallj committed Aug 19, 2022
1 parent eb3000f commit 34b9fc457b5247d7d2d732e6f28c9a80ff16abd7
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 112 deletions.
@@ -93,6 +93,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
unsigned len; /* match length, unused bytes */
unsigned dist; /* match distance */
unsigned char FAR *from; /* where to copy match from */
unsigned long old; /* look-behind buffer for extra bits */

/* copy state to local variables */
state = (struct inflate_state FAR *)strm->state;
@@ -127,6 +128,11 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
here = lcode[hold & lmask];
dolen:
op = (unsigned)(here.bits);
if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
}
old = hold;
hold >>= op;
bits -= op;
op = (unsigned)(here.op);
@@ -138,16 +144,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
}
else if (op & 16) { /* length base */
len = (unsigned)(here.val);
op &= 15; /* number of extra bits */
if (op) {
if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
}
len += (unsigned)hold & ((1U << op) - 1);
hold >>= op;
bits -= op;
}
len += ((old & ~((uint64_t)-1 << here.bits)) >> (op & 15));
Tracevv((stderr, "inflate: length %u\n", len));
if (bits < 15) {
hold += (unsigned long)(PUP(in)) << bits;
@@ -158,30 +155,28 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
here = dcode[hold & dmask];
dodist:
op = (unsigned)(here.bits);
if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
}
}
old = hold;
hold >>= op;
bits -= op;
op = (unsigned)(here.op);
if (op & 16) { /* distance base */
dist = (unsigned)(here.val);
op &= 15; /* number of extra bits */
if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
}
}
dist += (unsigned)hold & ((1U << op) - 1);
dist += ((old & ~((uint64_t)-1 << here.bits)) >> (op & 15));
#ifdef INFLATE_STRICT
if (dist > dmax) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
#endif
hold >>= op;
bits -= op;
Tracevv((stderr, "inflate: distance %u\n", dist));
op = (unsigned)(out - beg); /* max distance in output */
if (dist > op) { /* see if copy from window */
@@ -130,6 +130,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
unsigned dist; /* match distance */
unsigned char FAR *from; /* where to copy match from */
unsigned here32; /* table entry as integer */
inflate_holder_t old; /* look-behind buffer for extra bits */

/* copy state to local variables */
state = (struct inflate_state FAR *)strm->state;
@@ -208,6 +209,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
}
dolen:
op = (unsigned)(here.bits);
old = hold;
hold >>= op;
bits -= op;
op = (unsigned)(here.op);
@@ -219,37 +221,30 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
}
else if (op & 16) { /* length base */
len = (unsigned)(here.val);
op &= 15; /* number of extra bits */
if (op) {
len += (unsigned)hold & ((1U << op) - 1);
hold >>= op;
bits -= op;
}
len += ((old & ~((uint64_t)-1 << here.bits)) >> (op & 15));
Tracevv((stderr, "inflate: length %u\n", len));
TABLE_LOAD(dcode, hold & dmask);
/* we have two fast-path loads: 10+10 + 15+5 = 40,
but we may need to refill here in the worst case */
if (bits < 15 + 13) {
REFILL();
}
dodist:
op = (unsigned)(here.bits);
old = hold;
hold >>= op;
bits -= op;
op = (unsigned)(here.op);
if (op & 16) { /* distance base */
dist = (unsigned)(here.val);
op &= 15; /* number of extra bits */
/* we have two fast-path loads: 10+10 + 15+5 + 15 = 55,
but we may need to refill here in the worst case */
if (bits < op) {
REFILL();
}
dist += (unsigned)hold & ((1U << op) - 1);
dist += ((old & ~((uint64_t)-1 << here.bits)) >> (op & 15));
#ifdef INFLATE_STRICT
if (dist > dmax) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
#endif
hold >>= op;
bits -= op;
Tracevv((stderr, "inflate: distance %u\n", dist));
op = (unsigned)(out - beg); /* max distance in output */
if (dist > op) { /* see if copy from window */
@@ -8,87 +8,87 @@
*/

static const code lenfix[512] = {
{7,96,0},{8,0,80},{8,0,16},{8,20,115},{7,18,31},{8,0,112},{8,0,48},
{9,0,192},{7,16,10},{8,0,96},{8,0,32},{9,0,160},{8,0,0},{8,0,128},
{8,0,64},{9,0,224},{7,16,6},{8,0,88},{8,0,24},{9,0,144},{7,19,59},
{8,0,120},{8,0,56},{9,0,208},{7,17,17},{8,0,104},{8,0,40},{9,0,176},
{8,0,8},{8,0,136},{8,0,72},{9,0,240},{7,16,4},{8,0,84},{8,0,20},
{8,21,227},{7,19,43},{8,0,116},{8,0,52},{9,0,200},{7,17,13},{8,0,100},
{8,0,36},{9,0,168},{8,0,4},{8,0,132},{8,0,68},{9,0,232},{7,16,8},
{8,0,92},{8,0,28},{9,0,152},{7,20,83},{8,0,124},{8,0,60},{9,0,216},
{7,18,23},{8,0,108},{8,0,44},{9,0,184},{8,0,12},{8,0,140},{8,0,76},
{9,0,248},{7,16,3},{8,0,82},{8,0,18},{8,21,163},{7,19,35},{8,0,114},
{8,0,50},{9,0,196},{7,17,11},{8,0,98},{8,0,34},{9,0,164},{8,0,2},
{8,0,130},{8,0,66},{9,0,228},{7,16,7},{8,0,90},{8,0,26},{9,0,148},
{7,20,67},{8,0,122},{8,0,58},{9,0,212},{7,18,19},{8,0,106},{8,0,42},
{9,0,180},{8,0,10},{8,0,138},{8,0,74},{9,0,244},{7,16,5},{8,0,86},
{8,0,22},{8,72,0},{7,19,51},{8,0,118},{8,0,54},{9,0,204},{7,17,15},
{7,96,0},{8,0,80},{8,0,16},{12,24,115},{9,23,31},{8,0,112},{8,0,48},
{9,0,192},{7,23,10},{8,0,96},{8,0,32},{9,0,160},{8,0,0},{8,0,128},
{8,0,64},{9,0,224},{7,23,6},{8,0,88},{8,0,24},{9,0,144},{10,23,59},
{8,0,120},{8,0,56},{9,0,208},{8,23,17},{8,0,104},{8,0,40},{9,0,176},
{8,0,8},{8,0,136},{8,0,72},{9,0,240},{7,23,4},{8,0,84},{8,0,20},
{13,24,227},{10,23,43},{8,0,116},{8,0,52},{9,0,200},{8,23,13},{8,0,100},
{8,0,36},{9,0,168},{8,0,4},{8,0,132},{8,0,68},{9,0,232},{7,23,8},
{8,0,92},{8,0,28},{9,0,152},{11,23,83},{8,0,124},{8,0,60},{9,0,216},
{9,23,23},{8,0,108},{8,0,44},{9,0,184},{8,0,12},{8,0,140},{8,0,76},
{9,0,248},{7,23,3},{8,0,82},{8,0,18},{13,24,163},{10,23,35},{8,0,114},
{8,0,50},{9,0,196},{8,23,11},{8,0,98},{8,0,34},{9,0,164},{8,0,2},
{8,0,130},{8,0,66},{9,0,228},{7,23,7},{8,0,90},{8,0,26},{9,0,148},
{11,23,67},{8,0,122},{8,0,58},{9,0,212},{9,23,19},{8,0,106},{8,0,42},
{9,0,180},{8,0,10},{8,0,138},{8,0,74},{9,0,244},{7,23,5},{8,0,86},
{8,0,22},{16,72,0},{10,23,51},{8,0,118},{8,0,54},{9,0,204},{8,23,15},
{8,0,102},{8,0,38},{9,0,172},{8,0,6},{8,0,134},{8,0,70},{9,0,236},
{7,16,9},{8,0,94},{8,0,30},{9,0,156},{7,20,99},{8,0,126},{8,0,62},
{9,0,220},{7,18,27},{8,0,110},{8,0,46},{9,0,188},{8,0,14},{8,0,142},
{8,0,78},{9,0,252},{7,96,0},{8,0,81},{8,0,17},{8,21,131},{7,18,31},
{8,0,113},{8,0,49},{9,0,194},{7,16,10},{8,0,97},{8,0,33},{9,0,162},
{8,0,1},{8,0,129},{8,0,65},{9,0,226},{7,16,6},{8,0,89},{8,0,25},
{9,0,146},{7,19,59},{8,0,121},{8,0,57},{9,0,210},{7,17,17},{8,0,105},
{8,0,41},{9,0,178},{8,0,9},{8,0,137},{8,0,73},{9,0,242},{7,16,4},
{8,0,85},{8,0,21},{8,16,258},{7,19,43},{8,0,117},{8,0,53},{9,0,202},
{7,17,13},{8,0,101},{8,0,37},{9,0,170},{8,0,5},{8,0,133},{8,0,69},
{9,0,234},{7,16,8},{8,0,93},{8,0,29},{9,0,154},{7,20,83},{8,0,125},
{8,0,61},{9,0,218},{7,18,23},{8,0,109},{8,0,45},{9,0,186},{8,0,13},
{8,0,141},{8,0,77},{9,0,250},{7,16,3},{8,0,83},{8,0,19},{8,21,195},
{7,19,35},{8,0,115},{8,0,51},{9,0,198},{7,17,11},{8,0,99},{8,0,35},
{9,0,166},{8,0,3},{8,0,131},{8,0,67},{9,0,230},{7,16,7},{8,0,91},
{8,0,27},{9,0,150},{7,20,67},{8,0,123},{8,0,59},{9,0,214},{7,18,19},
{7,23,9},{8,0,94},{8,0,30},{9,0,156},{11,23,99},{8,0,126},{8,0,62},
{9,0,220},{9,23,27},{8,0,110},{8,0,46},{9,0,188},{8,0,14},{8,0,142},
{8,0,78},{9,0,252},{7,96,0},{8,0,81},{8,0,17},{13,24,131},{9,23,31},
{8,0,113},{8,0,49},{9,0,194},{7,23,10},{8,0,97},{8,0,33},{9,0,162},
{8,0,1},{8,0,129},{8,0,65},{9,0,226},{7,23,6},{8,0,89},{8,0,25},
{9,0,146},{10,23,59},{8,0,121},{8,0,57},{9,0,210},{8,23,17},{8,0,105},
{8,0,41},{9,0,178},{8,0,9},{8,0,137},{8,0,73},{9,0,242},{7,23,4},
{8,0,85},{8,0,21},{8,24,258},{10,23,43},{8,0,117},{8,0,53},{9,0,202},
{8,23,13},{8,0,101},{8,0,37},{9,0,170},{8,0,5},{8,0,133},{8,0,69},
{9,0,234},{7,23,8},{8,0,93},{8,0,29},{9,0,154},{11,23,83},{8,0,125},
{8,0,61},{9,0,218},{9,23,23},{8,0,109},{8,0,45},{9,0,186},{8,0,13},
{8,0,141},{8,0,77},{9,0,250},{7,23,3},{8,0,83},{8,0,19},{13,24,195},
{10,23,35},{8,0,115},{8,0,51},{9,0,198},{8,23,11},{8,0,99},{8,0,35},
{9,0,166},{8,0,3},{8,0,131},{8,0,67},{9,0,230},{7,23,7},{8,0,91},
{8,0,27},{9,0,150},{11,23,67},{8,0,123},{8,0,59},{9,0,214},{9,23,19},
{8,0,107},{8,0,43},{9,0,182},{8,0,11},{8,0,139},{8,0,75},{9,0,246},
{7,16,5},{8,0,87},{8,0,23},{8,78,0},{7,19,51},{8,0,119},{8,0,55},
{9,0,206},{7,17,15},{8,0,103},{8,0,39},{9,0,174},{8,0,7},{8,0,135},
{8,0,71},{9,0,238},{7,16,9},{8,0,95},{8,0,31},{9,0,158},{7,20,99},
{8,0,127},{8,0,63},{9,0,222},{7,18,27},{8,0,111},{8,0,47},{9,0,190},
{7,23,5},{8,0,87},{8,0,23},{22,78,0},{10,23,51},{8,0,119},{8,0,55},
{9,0,206},{8,23,15},{8,0,103},{8,0,39},{9,0,174},{8,0,7},{8,0,135},
{8,0,71},{9,0,238},{7,23,9},{8,0,95},{8,0,31},{9,0,158},{11,23,99},
{8,0,127},{8,0,63},{9,0,222},{9,23,27},{8,0,111},{8,0,47},{9,0,190},
{8,0,15},{8,0,143},{8,0,79},{9,0,254},{7,96,0},{8,0,80},{8,0,16},
{8,20,115},{7,18,31},{8,0,112},{8,0,48},{9,0,193},{7,16,10},{8,0,96},
{8,0,32},{9,0,161},{8,0,0},{8,0,128},{8,0,64},{9,0,225},{7,16,6},
{8,0,88},{8,0,24},{9,0,145},{7,19,59},{8,0,120},{8,0,56},{9,0,209},
{7,17,17},{8,0,104},{8,0,40},{9,0,177},{8,0,8},{8,0,136},{8,0,72},
{9,0,241},{7,16,4},{8,0,84},{8,0,20},{8,21,227},{7,19,43},{8,0,116},
{8,0,52},{9,0,201},{7,17,13},{8,0,100},{8,0,36},{9,0,169},{8,0,4},
{8,0,132},{8,0,68},{9,0,233},{7,16,8},{8,0,92},{8,0,28},{9,0,153},
{7,20,83},{8,0,124},{8,0,60},{9,0,217},{7,18,23},{8,0,108},{8,0,44},
{9,0,185},{8,0,12},{8,0,140},{8,0,76},{9,0,249},{7,16,3},{8,0,82},
{8,0,18},{8,21,163},{7,19,35},{8,0,114},{8,0,50},{9,0,197},{7,17,11},
{12,24,115},{9,23,31},{8,0,112},{8,0,48},{9,0,193},{7,23,10},{8,0,96},
{8,0,32},{9,0,161},{8,0,0},{8,0,128},{8,0,64},{9,0,225},{7,23,6},
{8,0,88},{8,0,24},{9,0,145},{10,23,59},{8,0,120},{8,0,56},{9,0,209},
{8,23,17},{8,0,104},{8,0,40},{9,0,177},{8,0,8},{8,0,136},{8,0,72},
{9,0,241},{7,23,4},{8,0,84},{8,0,20},{13,24,227},{10,23,43},{8,0,116},
{8,0,52},{9,0,201},{8,23,13},{8,0,100},{8,0,36},{9,0,169},{8,0,4},
{8,0,132},{8,0,68},{9,0,233},{7,23,8},{8,0,92},{8,0,28},{9,0,153},
{11,23,83},{8,0,124},{8,0,60},{9,0,217},{9,23,23},{8,0,108},{8,0,44},
{9,0,185},{8,0,12},{8,0,140},{8,0,76},{9,0,249},{7,23,3},{8,0,82},
{8,0,18},{13,24,163},{10,23,35},{8,0,114},{8,0,50},{9,0,197},{8,23,11},
{8,0,98},{8,0,34},{9,0,165},{8,0,2},{8,0,130},{8,0,66},{9,0,229},
{7,16,7},{8,0,90},{8,0,26},{9,0,149},{7,20,67},{8,0,122},{8,0,58},
{9,0,213},{7,18,19},{8,0,106},{8,0,42},{9,0,181},{8,0,10},{8,0,138},
{8,0,74},{9,0,245},{7,16,5},{8,0,86},{8,0,22},{8,72,0},{7,19,51},
{8,0,118},{8,0,54},{9,0,205},{7,17,15},{8,0,102},{8,0,38},{9,0,173},
{8,0,6},{8,0,134},{8,0,70},{9,0,237},{7,16,9},{8,0,94},{8,0,30},
{9,0,157},{7,20,99},{8,0,126},{8,0,62},{9,0,221},{7,18,27},{8,0,110},
{7,23,7},{8,0,90},{8,0,26},{9,0,149},{11,23,67},{8,0,122},{8,0,58},
{9,0,213},{9,23,19},{8,0,106},{8,0,42},{9,0,181},{8,0,10},{8,0,138},
{8,0,74},{9,0,245},{7,23,5},{8,0,86},{8,0,22},{16,72,0},{10,23,51},
{8,0,118},{8,0,54},{9,0,205},{8,23,15},{8,0,102},{8,0,38},{9,0,173},
{8,0,6},{8,0,134},{8,0,70},{9,0,237},{7,23,9},{8,0,94},{8,0,30},
{9,0,157},{11,23,99},{8,0,126},{8,0,62},{9,0,221},{9,23,27},{8,0,110},
{8,0,46},{9,0,189},{8,0,14},{8,0,142},{8,0,78},{9,0,253},{7,96,0},
{8,0,81},{8,0,17},{8,21,131},{7,18,31},{8,0,113},{8,0,49},{9,0,195},
{7,16,10},{8,0,97},{8,0,33},{9,0,163},{8,0,1},{8,0,129},{8,0,65},
{9,0,227},{7,16,6},{8,0,89},{8,0,25},{9,0,147},{7,19,59},{8,0,121},
{8,0,57},{9,0,211},{7,17,17},{8,0,105},{8,0,41},{9,0,179},{8,0,9},
{8,0,137},{8,0,73},{9,0,243},{7,16,4},{8,0,85},{8,0,21},{8,16,258},
{7,19,43},{8,0,117},{8,0,53},{9,0,203},{7,17,13},{8,0,101},{8,0,37},
{9,0,171},{8,0,5},{8,0,133},{8,0,69},{9,0,235},{7,16,8},{8,0,93},
{8,0,29},{9,0,155},{7,20,83},{8,0,125},{8,0,61},{9,0,219},{7,18,23},
{8,0,81},{8,0,17},{13,24,131},{9,23,31},{8,0,113},{8,0,49},{9,0,195},
{7,23,10},{8,0,97},{8,0,33},{9,0,163},{8,0,1},{8,0,129},{8,0,65},
{9,0,227},{7,23,6},{8,0,89},{8,0,25},{9,0,147},{10,23,59},{8,0,121},
{8,0,57},{9,0,211},{8,23,17},{8,0,105},{8,0,41},{9,0,179},{8,0,9},
{8,0,137},{8,0,73},{9,0,243},{7,23,4},{8,0,85},{8,0,21},{8,24,258},
{10,23,43},{8,0,117},{8,0,53},{9,0,203},{8,23,13},{8,0,101},{8,0,37},
{9,0,171},{8,0,5},{8,0,133},{8,0,69},{9,0,235},{7,23,8},{8,0,93},
{8,0,29},{9,0,155},{11,23,83},{8,0,125},{8,0,61},{9,0,219},{9,23,23},
{8,0,109},{8,0,45},{9,0,187},{8,0,13},{8,0,141},{8,0,77},{9,0,251},
{7,16,3},{8,0,83},{8,0,19},{8,21,195},{7,19,35},{8,0,115},{8,0,51},
{9,0,199},{7,17,11},{8,0,99},{8,0,35},{9,0,167},{8,0,3},{8,0,131},
{8,0,67},{9,0,231},{7,16,7},{8,0,91},{8,0,27},{9,0,151},{7,20,67},
{8,0,123},{8,0,59},{9,0,215},{7,18,19},{8,0,107},{8,0,43},{9,0,183},
{8,0,11},{8,0,139},{8,0,75},{9,0,247},{7,16,5},{8,0,87},{8,0,23},
{8,78,0},{7,19,51},{8,0,119},{8,0,55},{9,0,207},{7,17,15},{8,0,103},
{8,0,39},{9,0,175},{8,0,7},{8,0,135},{8,0,71},{9,0,239},{7,16,9},
{8,0,95},{8,0,31},{9,0,159},{7,20,99},{8,0,127},{8,0,63},{9,0,223},
{7,18,27},{8,0,111},{8,0,47},{9,0,191},{8,0,15},{8,0,143},{8,0,79},
{7,23,3},{8,0,83},{8,0,19},{13,24,195},{10,23,35},{8,0,115},{8,0,51},
{9,0,199},{8,23,11},{8,0,99},{8,0,35},{9,0,167},{8,0,3},{8,0,131},
{8,0,67},{9,0,231},{7,23,7},{8,0,91},{8,0,27},{9,0,151},{11,23,67},
{8,0,123},{8,0,59},{9,0,215},{9,23,19},{8,0,107},{8,0,43},{9,0,183},
{8,0,11},{8,0,139},{8,0,75},{9,0,247},{7,23,5},{8,0,87},{8,0,23},
{22,78,0},{10,23,51},{8,0,119},{8,0,55},{9,0,207},{8,23,15},{8,0,103},
{8,0,39},{9,0,175},{8,0,7},{8,0,135},{8,0,71},{9,0,239},{7,23,9},
{8,0,95},{8,0,31},{9,0,159},{11,23,99},{8,0,127},{8,0,63},{9,0,223},
{9,23,27},{8,0,111},{8,0,47},{9,0,191},{8,0,15},{8,0,143},{8,0,79},
{9,0,255}
};

static const code distfix[32] = {
{5,16,1},{5,23,257},{5,19,17},{5,27,4097},{5,17,5},{5,25,1025},
{5,21,65},{5,29,16385},{5,16,3},{5,24,513},{5,20,33},{5,28,8193},
{5,18,9},{5,26,2049},{5,22,129},{5,64,0},{5,16,2},{5,23,385},
{5,19,25},{5,27,6145},{5,17,7},{5,25,1537},{5,21,97},{5,29,24577},
{5,16,4},{5,24,769},{5,20,49},{5,28,12289},{5,18,13},{5,26,3073},
{5,22,193},{5,64,0}
{5,21,1},{12,21,257},{8,21,17},{16,21,4097},{6,21,5},{14,21,1025},
{10,21,65},{18,21,16385},{5,21,3},{13,21,513},{9,21,33},{17,21,8193},
{7,21,9},{15,21,2049},{11,21,129},{5,64,0},{5,21,2},{12,21,385},
{8,21,25},{16,21,6145},{6,21,7},{14,21,1537},{10,21,97},{18,21,24577},
{5,21,4},{13,21,769},{9,21,49},{17,21,12289},{7,21,13},{15,21,3073},
{11,21,193},{5,64,0}
};
@@ -1079,6 +1079,11 @@ int flush;
state->back = 0;
for (;;) {
here = state->lencode[BITS(state->lenbits)];
if (here.op & 16) {
int size = here.op & 15;
here.op = 16 | (here.bits - size);
here.bits = size;
}
if ((unsigned)(here.bits) <= bits) break;
PULLBYTE();
}
@@ -1087,6 +1092,11 @@ int flush;
for (;;) {
here = state->lencode[last.val +
(BITS(last.bits + last.op) >> last.bits)];
if (here.op & 16) {
int size = here.op & 15;
here.op = 16 | (here.bits - size);
here.bits = size;
}
if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE();
}
@@ -1129,6 +1139,11 @@ int flush;
case DIST:
for (;;) {
here = state->distcode[BITS(state->distbits)];
if (here.op & 16) {
int size = here.op & 15;
here.op = 16 | (here.bits - size);
here.bits = size;
}
if ((unsigned)(here.bits) <= bits) break;
PULLBYTE();
}
@@ -1137,6 +1152,11 @@ int flush;
for (;;) {
here = state->distcode[last.val +
(BITS(last.bits + last.op) >> last.bits)];
if (here.op & 16) {
int size = here.op & 15;
here.op = 16 | (here.bits - size);
here.bits = size;
}
if ((unsigned)(last.bits + here.bits) <= bits) break;
PULLBYTE();
}
@@ -221,7 +221,8 @@ unsigned short FAR *work;
here.val = work[sym];
}
else if ((int)(work[sym]) > end) {
here.op = (unsigned char)(extra[work[sym]]);
here.op = extra[work[sym]] & 16 ? here.bits | 16 : extra[work[sym]];
here.bits += extra[work[sym]] & 15;
here.val = base[work[sym]];
}
else {

0 comments on commit 34b9fc4

Please sign in to comment.