Prusa MINI Firmware overview
|
#include "zutil.h"
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"
◆ inflate_fast()
57 unsigned char FAR *out;
58 unsigned char FAR *beg;
78 unsigned char FAR *from;
86 end = out + (
strm->avail_out - 257);
96 lcode =
state->lencode;
97 dcode =
state->distcode;
98 lmask = (1U <<
state->lenbits) - 1;
99 dmask = (1U <<
state->distbits) - 1;
105 hold += (
unsigned long)(*in++) <<
bits;
107 hold += (
unsigned long)(*in++) <<
bits;
110 here = lcode[
hold & lmask];
112 op = (unsigned)(here.
bits);
115 op = (unsigned)(here.
op);
118 "inflate: literal '%c'\n" :
119 "inflate: literal 0x%02x\n", here.
val));
120 *out++ = (
unsigned char)(here.
val);
123 len = (unsigned)(here.
val);
127 hold += (
unsigned long)(*in++) <<
bits;
130 len += (unsigned)
hold & ((1U << op) - 1);
134 Tracevv((stderr,
"inflate: length %u\n", len));
136 hold += (
unsigned long)(*in++) <<
bits;
138 hold += (
unsigned long)(*in++) <<
bits;
141 here = dcode[
hold & dmask];
143 op = (unsigned)(here.
bits);
146 op = (unsigned)(here.
op);
148 dist = (unsigned)(here.
val);
151 hold += (
unsigned long)(*in++) <<
bits;
154 hold += (
unsigned long)(*in++) <<
bits;
158 dist += (unsigned)
hold & ((1U << op) - 1);
159 #ifdef INFLATE_STRICT
161 strm->msg = (
char *)
"invalid distance too far back";
168 Tracevv((stderr,
"inflate: distance %u\n", dist));
169 op = (unsigned)(out - beg);
175 (
char *)
"invalid distance too far back";
179 #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
180 if (len <= op -
whave) {
189 }
while (--op >
whave);
210 else if (
wnext < op) {
266 else if ((op & 64) == 0) {
267 here = dcode[here.
val + (
hold & ((1U << op) - 1))];
271 strm->msg = (
char *)
"invalid distance code";
276 else if ((op & 64) == 0) {
277 here = lcode[here.
val + (
hold & ((1U << op) - 1))];
281 Tracevv((stderr,
"inflate: end of block\n"));
286 strm->msg = (
char *)
"invalid literal/length code";
290 }
while (in <
last && out <
end);
300 strm->next_out = out;
302 strm->avail_out = (unsigned)(out <
end ?
303 257 + (
end - out) : 257 - (out -
end));
unsigned dmax
Definition: inflate.h:90
unsigned char FAR * window
Definition: inflate.h:99
unsigned short val
Definition: inftrees.h:27
unsigned wnext
Definition: inflate.h:98
unsigned wsize
Definition: inflate.h:96
start
Definition: g29_auto.py:150
unsigned whave
Definition: inflate.h:97
static volatile fsensor_t state
Definition: filament_sensor.c:23
end
Definition: createSpeedLookupTable.py:33
z_streamp strm
Definition: inflate.h:83
unsigned char op
Definition: inftrees.h:25
#define z_const
Definition: zconf.h:237
unsigned bits
Definition: inflate.h:102
#define FAR
Definition: zconf.h:387
int last
Definition: inflate.h:85
unsigned char bits
Definition: inftrees.h:26
unsigned long hold
Definition: inflate.h:101
Definition: inftrees.h:24
#define Tracevv(x)
Definition: zutil.h:251