Dependencies:   emwin_lib

Fork of DMemWin by Embedded Artists

Committer:
destinyXfate
Date:
Thu Jun 02 04:52:54 2016 +0000
Revision:
2:0e2ef1edf01b
;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
destinyXfate 2:0e2ef1edf01b 1 /* inffast.c -- fast decoding
destinyXfate 2:0e2ef1edf01b 2 * Copyright (C) 1995-2004 Mark Adler
destinyXfate 2:0e2ef1edf01b 3 * For conditions of distribution and use, see copyright notice in zlib.h
destinyXfate 2:0e2ef1edf01b 4 */
destinyXfate 2:0e2ef1edf01b 5
destinyXfate 2:0e2ef1edf01b 6 #include "zutil.h"
destinyXfate 2:0e2ef1edf01b 7 #include "inftrees.h"
destinyXfate 2:0e2ef1edf01b 8 #include "inflate.h"
destinyXfate 2:0e2ef1edf01b 9 #include "inffast.h"
destinyXfate 2:0e2ef1edf01b 10
destinyXfate 2:0e2ef1edf01b 11 #ifndef ASMINF
destinyXfate 2:0e2ef1edf01b 12
destinyXfate 2:0e2ef1edf01b 13 /* Allow machine dependent optimization for post-increment or pre-increment.
destinyXfate 2:0e2ef1edf01b 14 Based on testing to date,
destinyXfate 2:0e2ef1edf01b 15 Pre-increment preferred for:
destinyXfate 2:0e2ef1edf01b 16 - PowerPC G3 (Adler)
destinyXfate 2:0e2ef1edf01b 17 - MIPS R5000 (Randers-Pehrson)
destinyXfate 2:0e2ef1edf01b 18 Post-increment preferred for:
destinyXfate 2:0e2ef1edf01b 19 - none
destinyXfate 2:0e2ef1edf01b 20 No measurable difference:
destinyXfate 2:0e2ef1edf01b 21 - Pentium III (Anderson)
destinyXfate 2:0e2ef1edf01b 22 - M68060 (Nikl)
destinyXfate 2:0e2ef1edf01b 23 */
destinyXfate 2:0e2ef1edf01b 24 #ifdef POSTINC
destinyXfate 2:0e2ef1edf01b 25 # define OFF 0
destinyXfate 2:0e2ef1edf01b 26 # define PUP(a) *(a)++
destinyXfate 2:0e2ef1edf01b 27 #else
destinyXfate 2:0e2ef1edf01b 28 # define OFF 1
destinyXfate 2:0e2ef1edf01b 29 # define PUP(a) *++(a)
destinyXfate 2:0e2ef1edf01b 30 #endif
destinyXfate 2:0e2ef1edf01b 31
destinyXfate 2:0e2ef1edf01b 32 /*
destinyXfate 2:0e2ef1edf01b 33 Decode literal, length, and distance codes and write out the resulting
destinyXfate 2:0e2ef1edf01b 34 literal and match bytes until either not enough input or output is
destinyXfate 2:0e2ef1edf01b 35 available, an end-of-block is encountered, or a data error is encountered.
destinyXfate 2:0e2ef1edf01b 36 When large enough input and output buffers are supplied to inflate(), for
destinyXfate 2:0e2ef1edf01b 37 example, a 16K input buffer and a 64K output buffer, more than 95% of the
destinyXfate 2:0e2ef1edf01b 38 inflate execution time is spent in this routine.
destinyXfate 2:0e2ef1edf01b 39
destinyXfate 2:0e2ef1edf01b 40 Entry assumptions:
destinyXfate 2:0e2ef1edf01b 41
destinyXfate 2:0e2ef1edf01b 42 state->mode == LEN
destinyXfate 2:0e2ef1edf01b 43 strm->avail_in >= 6
destinyXfate 2:0e2ef1edf01b 44 strm->avail_out >= 258
destinyXfate 2:0e2ef1edf01b 45 start >= strm->avail_out
destinyXfate 2:0e2ef1edf01b 46 state->bits < 8
destinyXfate 2:0e2ef1edf01b 47
destinyXfate 2:0e2ef1edf01b 48 On return, state->mode is one of:
destinyXfate 2:0e2ef1edf01b 49
destinyXfate 2:0e2ef1edf01b 50 LEN -- ran out of enough output space or enough available input
destinyXfate 2:0e2ef1edf01b 51 TYPE -- reached end of block code, inflate() to interpret next block
destinyXfate 2:0e2ef1edf01b 52 BAD -- error in block data
destinyXfate 2:0e2ef1edf01b 53
destinyXfate 2:0e2ef1edf01b 54 Notes:
destinyXfate 2:0e2ef1edf01b 55
destinyXfate 2:0e2ef1edf01b 56 - The maximum input bits used by a length/distance pair is 15 bits for the
destinyXfate 2:0e2ef1edf01b 57 length code, 5 bits for the length extra, 15 bits for the distance code,
destinyXfate 2:0e2ef1edf01b 58 and 13 bits for the distance extra. This totals 48 bits, or six bytes.
destinyXfate 2:0e2ef1edf01b 59 Therefore if strm->avail_in >= 6, then there is enough input to avoid
destinyXfate 2:0e2ef1edf01b 60 checking for available input while decoding.
destinyXfate 2:0e2ef1edf01b 61
destinyXfate 2:0e2ef1edf01b 62 - The maximum bytes that a single length/distance pair can output is 258
destinyXfate 2:0e2ef1edf01b 63 bytes, which is the maximum length that can be coded. inflate_fast()
destinyXfate 2:0e2ef1edf01b 64 requires strm->avail_out >= 258 for each loop to avoid checking for
destinyXfate 2:0e2ef1edf01b 65 output space.
destinyXfate 2:0e2ef1edf01b 66 */
destinyXfate 2:0e2ef1edf01b 67 void inflate_fast(strm, start)
destinyXfate 2:0e2ef1edf01b 68 z_streamp strm;
destinyXfate 2:0e2ef1edf01b 69 unsigned start; /* inflate()'s starting value for strm->avail_out */
destinyXfate 2:0e2ef1edf01b 70 {
destinyXfate 2:0e2ef1edf01b 71 struct inflate_state FAR *state;
destinyXfate 2:0e2ef1edf01b 72 unsigned char FAR *in; /* local strm->next_in */
destinyXfate 2:0e2ef1edf01b 73 unsigned char FAR *last; /* while in < last, enough input available */
destinyXfate 2:0e2ef1edf01b 74 unsigned char FAR *out; /* local strm->next_out */
destinyXfate 2:0e2ef1edf01b 75 unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
destinyXfate 2:0e2ef1edf01b 76 unsigned char FAR *end; /* while out < end, enough space available */
destinyXfate 2:0e2ef1edf01b 77 #ifdef INFLATE_STRICT
destinyXfate 2:0e2ef1edf01b 78 unsigned dmax; /* maximum distance from zlib header */
destinyXfate 2:0e2ef1edf01b 79 #endif
destinyXfate 2:0e2ef1edf01b 80 unsigned wsize; /* window size or zero if not using window */
destinyXfate 2:0e2ef1edf01b 81 unsigned whave; /* valid bytes in the window */
destinyXfate 2:0e2ef1edf01b 82 unsigned write; /* window write index */
destinyXfate 2:0e2ef1edf01b 83 unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
destinyXfate 2:0e2ef1edf01b 84 unsigned long hold; /* local strm->hold */
destinyXfate 2:0e2ef1edf01b 85 unsigned bits; /* local strm->bits */
destinyXfate 2:0e2ef1edf01b 86 code const FAR *lcode; /* local strm->lencode */
destinyXfate 2:0e2ef1edf01b 87 code const FAR *dcode; /* local strm->distcode */
destinyXfate 2:0e2ef1edf01b 88 unsigned lmask; /* mask for first level of length codes */
destinyXfate 2:0e2ef1edf01b 89 unsigned dmask; /* mask for first level of distance codes */
destinyXfate 2:0e2ef1edf01b 90 code this; /* retrieved table entry */
destinyXfate 2:0e2ef1edf01b 91 unsigned op; /* code bits, operation, extra bits, or */
destinyXfate 2:0e2ef1edf01b 92 /* window position, window bytes to copy */
destinyXfate 2:0e2ef1edf01b 93 unsigned len; /* match length, unused bytes */
destinyXfate 2:0e2ef1edf01b 94 unsigned dist; /* match distance */
destinyXfate 2:0e2ef1edf01b 95 unsigned char FAR *from; /* where to copy match from */
destinyXfate 2:0e2ef1edf01b 96
destinyXfate 2:0e2ef1edf01b 97 /* copy state to local variables */
destinyXfate 2:0e2ef1edf01b 98 state = (struct inflate_state FAR *)strm->state;
destinyXfate 2:0e2ef1edf01b 99 in = strm->next_in - OFF;
destinyXfate 2:0e2ef1edf01b 100 last = in + (strm->avail_in - 5);
destinyXfate 2:0e2ef1edf01b 101 out = strm->next_out - OFF;
destinyXfate 2:0e2ef1edf01b 102 beg = out - (start - strm->avail_out);
destinyXfate 2:0e2ef1edf01b 103 end = out + (strm->avail_out - 257);
destinyXfate 2:0e2ef1edf01b 104 #ifdef INFLATE_STRICT
destinyXfate 2:0e2ef1edf01b 105 dmax = state->dmax;
destinyXfate 2:0e2ef1edf01b 106 #endif
destinyXfate 2:0e2ef1edf01b 107 wsize = state->wsize;
destinyXfate 2:0e2ef1edf01b 108 whave = state->whave;
destinyXfate 2:0e2ef1edf01b 109 write = state->write;
destinyXfate 2:0e2ef1edf01b 110 window = state->window;
destinyXfate 2:0e2ef1edf01b 111 hold = state->hold;
destinyXfate 2:0e2ef1edf01b 112 bits = state->bits;
destinyXfate 2:0e2ef1edf01b 113 lcode = state->lencode;
destinyXfate 2:0e2ef1edf01b 114 dcode = state->distcode;
destinyXfate 2:0e2ef1edf01b 115 lmask = (1U << state->lenbits) - 1;
destinyXfate 2:0e2ef1edf01b 116 dmask = (1U << state->distbits) - 1;
destinyXfate 2:0e2ef1edf01b 117
destinyXfate 2:0e2ef1edf01b 118 /* decode literals and length/distances until end-of-block or not enough
destinyXfate 2:0e2ef1edf01b 119 input data or output space */
destinyXfate 2:0e2ef1edf01b 120 do {
destinyXfate 2:0e2ef1edf01b 121 if (bits < 15) {
destinyXfate 2:0e2ef1edf01b 122 hold += (unsigned long)(PUP(in)) << bits;
destinyXfate 2:0e2ef1edf01b 123 bits += 8;
destinyXfate 2:0e2ef1edf01b 124 hold += (unsigned long)(PUP(in)) << bits;
destinyXfate 2:0e2ef1edf01b 125 bits += 8;
destinyXfate 2:0e2ef1edf01b 126 }
destinyXfate 2:0e2ef1edf01b 127 this = lcode[hold & lmask];
destinyXfate 2:0e2ef1edf01b 128 dolen:
destinyXfate 2:0e2ef1edf01b 129 op = (unsigned)(this.bits);
destinyXfate 2:0e2ef1edf01b 130 hold >>= op;
destinyXfate 2:0e2ef1edf01b 131 bits -= op;
destinyXfate 2:0e2ef1edf01b 132 op = (unsigned)(this.op);
destinyXfate 2:0e2ef1edf01b 133 if (op == 0) { /* literal */
destinyXfate 2:0e2ef1edf01b 134 Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
destinyXfate 2:0e2ef1edf01b 135 "inflate: literal '%c'\n" :
destinyXfate 2:0e2ef1edf01b 136 "inflate: literal 0x%02x\n", this.val));
destinyXfate 2:0e2ef1edf01b 137 PUP(out) = (unsigned char)(this.val);
destinyXfate 2:0e2ef1edf01b 138 }
destinyXfate 2:0e2ef1edf01b 139 else if (op & 16) { /* length base */
destinyXfate 2:0e2ef1edf01b 140 len = (unsigned)(this.val);
destinyXfate 2:0e2ef1edf01b 141 op &= 15; /* number of extra bits */
destinyXfate 2:0e2ef1edf01b 142 if (op) {
destinyXfate 2:0e2ef1edf01b 143 if (bits < op) {
destinyXfate 2:0e2ef1edf01b 144 hold += (unsigned long)(PUP(in)) << bits;
destinyXfate 2:0e2ef1edf01b 145 bits += 8;
destinyXfate 2:0e2ef1edf01b 146 }
destinyXfate 2:0e2ef1edf01b 147 len += (unsigned)hold & ((1U << op) - 1);
destinyXfate 2:0e2ef1edf01b 148 hold >>= op;
destinyXfate 2:0e2ef1edf01b 149 bits -= op;
destinyXfate 2:0e2ef1edf01b 150 }
destinyXfate 2:0e2ef1edf01b 151 Tracevv((stderr, "inflate: length %u\n", len));
destinyXfate 2:0e2ef1edf01b 152 if (bits < 15) {
destinyXfate 2:0e2ef1edf01b 153 hold += (unsigned long)(PUP(in)) << bits;
destinyXfate 2:0e2ef1edf01b 154 bits += 8;
destinyXfate 2:0e2ef1edf01b 155 hold += (unsigned long)(PUP(in)) << bits;
destinyXfate 2:0e2ef1edf01b 156 bits += 8;
destinyXfate 2:0e2ef1edf01b 157 }
destinyXfate 2:0e2ef1edf01b 158 this = dcode[hold & dmask];
destinyXfate 2:0e2ef1edf01b 159 dodist:
destinyXfate 2:0e2ef1edf01b 160 op = (unsigned)(this.bits);
destinyXfate 2:0e2ef1edf01b 161 hold >>= op;
destinyXfate 2:0e2ef1edf01b 162 bits -= op;
destinyXfate 2:0e2ef1edf01b 163 op = (unsigned)(this.op);
destinyXfate 2:0e2ef1edf01b 164 if (op & 16) { /* distance base */
destinyXfate 2:0e2ef1edf01b 165 dist = (unsigned)(this.val);
destinyXfate 2:0e2ef1edf01b 166 op &= 15; /* number of extra bits */
destinyXfate 2:0e2ef1edf01b 167 if (bits < op) {
destinyXfate 2:0e2ef1edf01b 168 hold += (unsigned long)(PUP(in)) << bits;
destinyXfate 2:0e2ef1edf01b 169 bits += 8;
destinyXfate 2:0e2ef1edf01b 170 if (bits < op) {
destinyXfate 2:0e2ef1edf01b 171 hold += (unsigned long)(PUP(in)) << bits;
destinyXfate 2:0e2ef1edf01b 172 bits += 8;
destinyXfate 2:0e2ef1edf01b 173 }
destinyXfate 2:0e2ef1edf01b 174 }
destinyXfate 2:0e2ef1edf01b 175 dist += (unsigned)hold & ((1U << op) - 1);
destinyXfate 2:0e2ef1edf01b 176 #ifdef INFLATE_STRICT
destinyXfate 2:0e2ef1edf01b 177 if (dist > dmax) {
destinyXfate 2:0e2ef1edf01b 178 strm->msg = (char *)"invalid distance too far back";
destinyXfate 2:0e2ef1edf01b 179 state->mode = BAD;
destinyXfate 2:0e2ef1edf01b 180 break;
destinyXfate 2:0e2ef1edf01b 181 }
destinyXfate 2:0e2ef1edf01b 182 #endif
destinyXfate 2:0e2ef1edf01b 183 hold >>= op;
destinyXfate 2:0e2ef1edf01b 184 bits -= op;
destinyXfate 2:0e2ef1edf01b 185 Tracevv((stderr, "inflate: distance %u\n", dist));
destinyXfate 2:0e2ef1edf01b 186 op = (unsigned)(out - beg); /* max distance in output */
destinyXfate 2:0e2ef1edf01b 187 if (dist > op) { /* see if copy from window */
destinyXfate 2:0e2ef1edf01b 188 op = dist - op; /* distance back in window */
destinyXfate 2:0e2ef1edf01b 189 if (op > whave) {
destinyXfate 2:0e2ef1edf01b 190 strm->msg = (char *)"invalid distance too far back";
destinyXfate 2:0e2ef1edf01b 191 state->mode = BAD;
destinyXfate 2:0e2ef1edf01b 192 break;
destinyXfate 2:0e2ef1edf01b 193 }
destinyXfate 2:0e2ef1edf01b 194 from = window - OFF;
destinyXfate 2:0e2ef1edf01b 195 if (write == 0) { /* very common case */
destinyXfate 2:0e2ef1edf01b 196 from += wsize - op;
destinyXfate 2:0e2ef1edf01b 197 if (op < len) { /* some from window */
destinyXfate 2:0e2ef1edf01b 198 len -= op;
destinyXfate 2:0e2ef1edf01b 199 do {
destinyXfate 2:0e2ef1edf01b 200 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 201 } while (--op);
destinyXfate 2:0e2ef1edf01b 202 from = out - dist; /* rest from output */
destinyXfate 2:0e2ef1edf01b 203 }
destinyXfate 2:0e2ef1edf01b 204 }
destinyXfate 2:0e2ef1edf01b 205 else if (write < op) { /* wrap around window */
destinyXfate 2:0e2ef1edf01b 206 from += wsize + write - op;
destinyXfate 2:0e2ef1edf01b 207 op -= write;
destinyXfate 2:0e2ef1edf01b 208 if (op < len) { /* some from end of window */
destinyXfate 2:0e2ef1edf01b 209 len -= op;
destinyXfate 2:0e2ef1edf01b 210 do {
destinyXfate 2:0e2ef1edf01b 211 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 212 } while (--op);
destinyXfate 2:0e2ef1edf01b 213 from = window - OFF;
destinyXfate 2:0e2ef1edf01b 214 if (write < len) { /* some from start of window */
destinyXfate 2:0e2ef1edf01b 215 op = write;
destinyXfate 2:0e2ef1edf01b 216 len -= op;
destinyXfate 2:0e2ef1edf01b 217 do {
destinyXfate 2:0e2ef1edf01b 218 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 219 } while (--op);
destinyXfate 2:0e2ef1edf01b 220 from = out - dist; /* rest from output */
destinyXfate 2:0e2ef1edf01b 221 }
destinyXfate 2:0e2ef1edf01b 222 }
destinyXfate 2:0e2ef1edf01b 223 }
destinyXfate 2:0e2ef1edf01b 224 else { /* contiguous in window */
destinyXfate 2:0e2ef1edf01b 225 from += write - op;
destinyXfate 2:0e2ef1edf01b 226 if (op < len) { /* some from window */
destinyXfate 2:0e2ef1edf01b 227 len -= op;
destinyXfate 2:0e2ef1edf01b 228 do {
destinyXfate 2:0e2ef1edf01b 229 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 230 } while (--op);
destinyXfate 2:0e2ef1edf01b 231 from = out - dist; /* rest from output */
destinyXfate 2:0e2ef1edf01b 232 }
destinyXfate 2:0e2ef1edf01b 233 }
destinyXfate 2:0e2ef1edf01b 234 while (len > 2) {
destinyXfate 2:0e2ef1edf01b 235 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 236 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 237 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 238 len -= 3;
destinyXfate 2:0e2ef1edf01b 239 }
destinyXfate 2:0e2ef1edf01b 240 if (len) {
destinyXfate 2:0e2ef1edf01b 241 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 242 if (len > 1)
destinyXfate 2:0e2ef1edf01b 243 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 244 }
destinyXfate 2:0e2ef1edf01b 245 }
destinyXfate 2:0e2ef1edf01b 246 else {
destinyXfate 2:0e2ef1edf01b 247 from = out - dist; /* copy direct from output */
destinyXfate 2:0e2ef1edf01b 248 do { /* minimum length is three */
destinyXfate 2:0e2ef1edf01b 249 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 250 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 251 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 252 len -= 3;
destinyXfate 2:0e2ef1edf01b 253 } while (len > 2);
destinyXfate 2:0e2ef1edf01b 254 if (len) {
destinyXfate 2:0e2ef1edf01b 255 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 256 if (len > 1)
destinyXfate 2:0e2ef1edf01b 257 PUP(out) = PUP(from);
destinyXfate 2:0e2ef1edf01b 258 }
destinyXfate 2:0e2ef1edf01b 259 }
destinyXfate 2:0e2ef1edf01b 260 }
destinyXfate 2:0e2ef1edf01b 261 else if ((op & 64) == 0) { /* 2nd level distance code */
destinyXfate 2:0e2ef1edf01b 262 this = dcode[this.val + (hold & ((1U << op) - 1))];
destinyXfate 2:0e2ef1edf01b 263 goto dodist;
destinyXfate 2:0e2ef1edf01b 264 }
destinyXfate 2:0e2ef1edf01b 265 else {
destinyXfate 2:0e2ef1edf01b 266 strm->msg = (char *)"invalid distance code";
destinyXfate 2:0e2ef1edf01b 267 state->mode = BAD;
destinyXfate 2:0e2ef1edf01b 268 break;
destinyXfate 2:0e2ef1edf01b 269 }
destinyXfate 2:0e2ef1edf01b 270 }
destinyXfate 2:0e2ef1edf01b 271 else if ((op & 64) == 0) { /* 2nd level length code */
destinyXfate 2:0e2ef1edf01b 272 this = lcode[this.val + (hold & ((1U << op) - 1))];
destinyXfate 2:0e2ef1edf01b 273 goto dolen;
destinyXfate 2:0e2ef1edf01b 274 }
destinyXfate 2:0e2ef1edf01b 275 else if (op & 32) { /* end-of-block */
destinyXfate 2:0e2ef1edf01b 276 Tracevv((stderr, "inflate: end of block\n"));
destinyXfate 2:0e2ef1edf01b 277 state->mode = TYPE;
destinyXfate 2:0e2ef1edf01b 278 break;
destinyXfate 2:0e2ef1edf01b 279 }
destinyXfate 2:0e2ef1edf01b 280 else {
destinyXfate 2:0e2ef1edf01b 281 strm->msg = (char *)"invalid literal/length code";
destinyXfate 2:0e2ef1edf01b 282 state->mode = BAD;
destinyXfate 2:0e2ef1edf01b 283 break;
destinyXfate 2:0e2ef1edf01b 284 }
destinyXfate 2:0e2ef1edf01b 285 } while (in < last && out < end);
destinyXfate 2:0e2ef1edf01b 286
destinyXfate 2:0e2ef1edf01b 287 /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
destinyXfate 2:0e2ef1edf01b 288 len = bits >> 3;
destinyXfate 2:0e2ef1edf01b 289 in -= len;
destinyXfate 2:0e2ef1edf01b 290 bits -= len << 3;
destinyXfate 2:0e2ef1edf01b 291 hold &= (1U << bits) - 1;
destinyXfate 2:0e2ef1edf01b 292
destinyXfate 2:0e2ef1edf01b 293 /* update state and return */
destinyXfate 2:0e2ef1edf01b 294 strm->next_in = in + OFF;
destinyXfate 2:0e2ef1edf01b 295 strm->next_out = out + OFF;
destinyXfate 2:0e2ef1edf01b 296 strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
destinyXfate 2:0e2ef1edf01b 297 strm->avail_out = (unsigned)(out < end ?
destinyXfate 2:0e2ef1edf01b 298 257 + (end - out) : 257 - (out - end));
destinyXfate 2:0e2ef1edf01b 299 state->hold = hold;
destinyXfate 2:0e2ef1edf01b 300 state->bits = bits;
destinyXfate 2:0e2ef1edf01b 301 return;
destinyXfate 2:0e2ef1edf01b 302 }
destinyXfate 2:0e2ef1edf01b 303
destinyXfate 2:0e2ef1edf01b 304 /*
destinyXfate 2:0e2ef1edf01b 305 inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
destinyXfate 2:0e2ef1edf01b 306 - Using bit fields for code structure
destinyXfate 2:0e2ef1edf01b 307 - Different op definition to avoid & for extra bits (do & for table bits)
destinyXfate 2:0e2ef1edf01b 308 - Three separate decoding do-loops for direct, window, and write == 0
destinyXfate 2:0e2ef1edf01b 309 - Special case for distance > 1 copies to do overlapped load and store copy
destinyXfate 2:0e2ef1edf01b 310 - Explicit branch predictions (based on measured branch probabilities)
destinyXfate 2:0e2ef1edf01b 311 - Deferring match copy and interspersed it with decoding subsequent codes
destinyXfate 2:0e2ef1edf01b 312 - Swapping literal/length else
destinyXfate 2:0e2ef1edf01b 313 - Swapping window/direct else
destinyXfate 2:0e2ef1edf01b 314 - Larger unrolled copy loops (three is about right)
destinyXfate 2:0e2ef1edf01b 315 - Moving len -= 3 statement into middle of loop
destinyXfate 2:0e2ef1edf01b 316 */
destinyXfate 2:0e2ef1edf01b 317
destinyXfate 2:0e2ef1edf01b 318 #endif /* !ASMINF */
destinyXfate 2:0e2ef1edf01b 319