Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\zlib_inflate\inffast.c Create Date:2022-07-28 06:57:44
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Decode literal, length, and distance codes and write out the resultingliteral and match bytes until either not enough input or output isavailable, an end-of-block is encountered, or a data error is encountered

Proto:void inflate_fast(z_streamp strm, unsigned start)

Type:void

Parameter:

TypeParameterName
z_streampstrm>avail_in >= 6
unsignedstart
117  state = not visible by applications
118  in = next input byte - OFF
119  last = in + number of bytes available at next_in - 5
120  out = next output byte should be put there - OFF
121  beg = out - start - remaining free space at next_out
122  end = out + remaining free space at next_out - 257
126  wsize = window size or zero if not using window
127  whave = valid bytes in the window
128  write = window write index
129  window = allocated sliding window, if needed
130  hold = put bit accumulator
131  bits = umber of bits in "in"
132  lcode = starting table for length/literal codes
133  dcode = starting table for distance codes
134  lmask = (1U << dex bits for lencode ) - 1
135  dmask = (1U << dex bits for distcode ) - 1
139  Do
140  If bits < 15 Then
141  hold += PUP(in) << bits
142  bits += 8
143  hold += PUP(in) << bits
144  bits += 8
146  this = lcode[hold & lmask]
147  dolen :
148  op = s in this part of the code
149  hold >>= op
150  bits -= op
151  op = peration, extra bits, table bits
152  If op == 0 Then
155  Else if op & 16 Then
157  op &= 15
158  If op Then
159  If bits < op Then
160  hold += PUP(in) << bits
161  bits += 8
163  len += hold & (1U << op) - 1
164  hold >>= op
165  bits -= op
167  If bits < 15 Then
168  hold += PUP(in) << bits
169  bits += 8
170  hold += PUP(in) << bits
171  bits += 8
173  this = dcode[hold & dmask]
174  dodist :
176  hold >>= op
177  bits -= op
179  If op & 16 Then
181  op &= 15
182  If bits < op Then
183  hold += PUP(in) << bits
184  bits += 8
185  If bits < op Then
186  hold += PUP(in) << bits
187  bits += 8
190  dist += hold & (1U << op) - 1
198  hold >>= op
199  bits -= op
200  op = out - beg
201  If dist > op Then
202  op = dist - op
203  If op > whave Then
208  from = window - OFF
209  If write == 0 Then
210  from += wsize - op
211  If op < len Then
212  len -= op
213  Do
214  PUP(out) = PUP(from)
215  When --op cycle
216  from = out - dist
219  Else if write < op Then
220  from += wsize + write - op
221  op -= write
222  If op < len Then
223  len -= op
224  Do
225  PUP(out) = PUP(from)
226  When --op cycle
227  from = window - OFF
228  If write < len Then
229  op = write
230  len -= op
231  Do
232  PUP(out) = PUP(from)
233  When --op cycle
234  from = out - dist
238  Else
239  from += write - op
240  If op < len Then
241  len -= op
242  Do
243  PUP(out) = PUP(from)
244  When --op cycle
245  from = out - dist
248  When len > 2 cycle
249  PUP(out) = PUP(from)
250  PUP(out) = PUP(from)
251  PUP(out) = PUP(from)
252  len -= 3
254  If len Then
255  PUP(out) = PUP(from)
256  If len > 1 Then PUP(out) = PUP(from)
260  Else
264  from = out - dist
267  If Not ( out - 1 + OFF & 1) Then
268  PUP(out) = PUP(from)
269  len--
271  sout = out - OFF
272  If dist > 2 Then
275  sfrom = from - OFF
276  loops = len >> 1
277  Do
283  When --loops cycle
284  out = sout + OFF
285  from = sfrom + OFF
286  Else
289  pat16 = *( sout - 1 + OFF)
290  If dist == 1 Then
293  us = pat16
294  b[0] = b[1]
295  pat16 = us
297  loops = len >> 1
298  Do
299  PUP(sout) = pat16
300  When --loops cycle
301  out = sout + OFF
303  If len & 1 Then PUP(out) = PUP(from)
307  Else if (op & 64) == 0 Then
308  this = dcode[ffset in table or code value + (hold & ((1U << op) - 1))]
309  Go to dodist
311  Else
317  Else if (op & 64) == 0 Then
318  this = lcode[ffset in table or code value + (hold & ((1U << op) - 1))]
319  Go to dolen
321  Else if op & 32 Then
323  Break
325  Else
326  last error message, NULL if no error = "invalid literal/length code"
328  Break
330  When in < last && out < end cycle
333  len = bits >> 3
334  in -= len
335  bits -= len << 3
336  hold &= (1U << bits) - 1
339  next input byte = in + OFF
340  next output byte should be put there = out + OFF
341  number of bytes available at next_in = If in < last Then 5 + last - in Else 5 - in - last
342  remaining free space at next_out = If out < end Then 257 + end - out Else 257 - out - end
344  put bit accumulator = hold
345  umber of bits in "in" = bits
346  Return
Caller
NameDescribe
zlib_inflatelate() uses a state machine to process as much input data and generate asmuch output data as possible before returning