30 static inline unsigned short
31 get_unaligned16(
const unsigned short *
p)
34 unsigned char *
b = (
unsigned char *)p;
43 # define PUP(a) *(a)++
44 # define UP_UNALIGNED(a) get_unaligned16((a)++)
47 # define PUP(a) *++(a)
48 # define UP_UNALIGNED(a) get_unaligned16(++(a))
91 const unsigned char *
in;
92 const unsigned char *
last;
123 #ifdef INFLATE_STRICT
126 wsize = state->
wsize;
127 whave = state->
whave;
128 write = state->
write;
141 hold += (
unsigned long)(
PUP(in)) << bits;
143 hold += (
unsigned long)(
PUP(in)) << bits;
146 this = lcode[hold & lmask];
148 op = (unsigned)(this.bits);
151 op = (unsigned)(this.op);
156 len = (unsigned)(this.
val);
160 hold += (
unsigned long)(
PUP(in)) << bits;
163 len += (unsigned)hold & ((1
U << op) - 1);
168 hold += (
unsigned long)(
PUP(in)) << bits;
170 hold += (
unsigned long)(
PUP(in)) << bits;
173 this = dcode[hold & dmask];
175 op = (unsigned)(this.bits);
178 op = (unsigned)(this.op);
180 dist = (unsigned)(this.
val);
183 hold += (
unsigned long)(
PUP(in)) << bits;
186 hold += (
unsigned long)(
PUP(in)) << bits;
190 dist += (unsigned)hold & ((1
U << op) - 1);
191 #ifdef INFLATE_STRICT
193 strm->
msg = (
char *)
"invalid distance too far back";
200 op = (unsigned)(out - beg);
204 strm->
msg = (
char *)
"invalid distance too far back";
219 else if (write < op) {
220 from += wsize + write -
op;
261 unsigned short *sout;
267 if (!((
long)(out - 1 +
OFF) & 1)) {
271 sout = (
unsigned short *)(out -
OFF);
273 unsigned short *sfrom;
275 sfrom = (
unsigned short *)(from -
OFF);
278 #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
284 out = (
unsigned char *)sout +
OFF;
285 from = (
unsigned char *)sfrom +
OFF;
287 unsigned short pat16;
289 pat16 = *(sout-1+
OFF);
301 out = (
unsigned char *)sout +
OFF;
307 else if ((op & 64) == 0) {
308 this = dcode[this.
val + (hold & ((1
U <<
op) - 1))];
312 strm->
msg = (
char *)
"invalid distance code";
317 else if ((op & 64) == 0) {
318 this = lcode[this.
val + (hold & ((1
U <<
op) - 1))];
326 strm->
msg = (
char *)
"invalid literal/length code";
330 }
while (in < last && out < end);
336 hold &= (1
U <<
bits) - 1;
341 strm->
avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
343 257 + (end - out) : 257 - (out -
end));