MCPcopy Create free account
hub / github.com/F-Stack/f-stack / inflate_fast

Function inflate_fast

freebsd/contrib/zlib/inffast.c:50–307  ·  view source on GitHub ↗

Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time i

(strm, start)

Source from the content-addressed store, hash-verified

48 output space.
49 */
50void ZLIB_INTERNAL inflate_fast(strm, start)
51z_streamp strm;
52unsigned start; /* inflate()'s starting value for strm->avail_out */
53{
54 struct inflate_state FAR *state;
55 z_const unsigned char FAR *in; /* local strm->next_in */
56 z_const unsigned char FAR *last; /* have enough input while in < last */
57 unsigned char FAR *out; /* local strm->next_out */
58 unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
59 unsigned char FAR *end; /* while out < end, enough space available */
60#ifdef INFLATE_STRICT
61 unsigned dmax; /* maximum distance from zlib header */
62#endif
63 unsigned wsize; /* window size or zero if not using window */
64 unsigned whave; /* valid bytes in the window */
65 unsigned wnext; /* window write index */
66 unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
67 unsigned long hold; /* local strm->hold */
68 unsigned bits; /* local strm->bits */
69 code const FAR *lcode; /* local strm->lencode */
70 code const FAR *dcode; /* local strm->distcode */
71 unsigned lmask; /* mask for first level of length codes */
72 unsigned dmask; /* mask for first level of distance codes */
73 code here; /* retrieved table entry */
74 unsigned op; /* code bits, operation, extra bits, or */
75 /* window position, window bytes to copy */
76 unsigned len; /* match length, unused bytes */
77 unsigned dist; /* match distance */
78 unsigned char FAR *from; /* where to copy match from */
79
80 /* copy state to local variables */
81 state = (struct inflate_state FAR *)strm->state;
82 in = strm->next_in;
83 last = in + (strm->avail_in - 5);
84 out = strm->next_out;
85 beg = out - (start - strm->avail_out);
86 end = out + (strm->avail_out - 257);
87#ifdef INFLATE_STRICT
88 dmax = state->dmax;
89#endif
90 wsize = state->wsize;
91 whave = state->whave;
92 wnext = state->wnext;
93 window = state->window;
94 hold = state->hold;
95 bits = state->bits;
96 lcode = state->lencode;
97 dcode = state->distcode;
98 lmask = (1U << state->lenbits) - 1;
99 dmask = (1U << state->distbits) - 1;
100
101 /* decode literals and length/distances until end-of-block or not enough
102 input data or output space */
103 do {
104 if (bits < 15) {
105 hold += (unsigned long)(*in++) << bits;
106 bits += 8;
107 hold += (unsigned long)(*in++) << bits;

Callers 2

inflateBackFunction · 0.85
inflate.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected