Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:LZ4_decompress_generic() :* This generic decompression function covers all use cases.* It shall be instantiated several times, using different sets of directives.* Note that it is important for performance that this function really get inlined,

Proto:static inline __attribute__((__always_inline__)) int LZ4_decompress_generic(const char *const src, char *const dst, int srcSize, int outputSize, endCondition_directive endOnInput, earlyEnd_directive partialDecoding, dict_directive dict, const BYTE *const lowPrefix, const BYTE *const dictStart, const size_t dictSize)

Type:int

Parameter:

TypeParameterName
const char *constsrc
char *constdst
intsrcSize
intoutputSizeIf endOnInput == endOnInputSize,* this value is `dstCapacity`
endCondition_directiveendOnInputdOnOutputSize, endOnInputSize
earlyEnd_directivepartialDecodingull, partial
dict_directivedictDict, withPrefix64k, usingExtDict
const BYTE *constlowPrefixalways <= dst, == dst when no prefix
const BYTE *constdictStartly if dict == usingExtDict
const size_tdictSize : = 0 if noDict
83  ip = src
84  iend = ip + srcSize
86  op = dst
87  oend = op + If endOnInput == endOnInputSize,* this value is `dstCapacity`
90  dictEnd = ly if dict == usingExtDict + : = 0 if noDict
91  static const unsigned int inc32table[8] = {0, 1, 2, 1, 0, 4, 4, 4}
92  static const int dec64table[8] = {0, 0, 0, - 1, - 4, 1, 2, 3}
94  safeDecode = dOnOutputSize, endOnInputSize == endOnInputSize
95  checkOffset = safeDecode && : = 0 if noDict < 64 * KB
98  shortiend = iend - If dOnOutputSize, endOnInputSize Then 14 Else 8 - 2
100  shortoend = oend - If dOnOutputSize, endOnInputSize Then 14 Else 8 - 18
107  assert(always <= dst, == dst when no prefix <= op)
108  assert(src != NULL)
111  If dOnOutputSize, endOnInputSize && Value for the false possibility is greater at compile time(If endOnInput == endOnInputSize,* this value is `dstCapacity` == 0) Then Return If srcSize == 1 && ip == 0 Then 0 Else -1
114  If Not dOnOutputSize, endOnInputSize && Value for the false possibility is greater at compile time(If endOnInput == endOnInputSize,* this value is `dstCapacity` == 0) Then Return If ip == 0 Then 1 Else -1
117  If dOnOutputSize, endOnInputSize && Value for the false possibility is greater at compile time(srcSize == 0) Then Return -1
121  When 1 cycle
127  token = ip++
128  length = token >> ML_BITS
131  assert(!dOnOutputSize, endOnInputSize || ip <= iend)
154  op += length
154  ip += length
161  length = token & ML_MASK
163  ip += 2
164  match = op - offset
165  assert(match <= op)
172  No 3D Now!(op + 0, match + 0, 8)
173  No 3D Now!(op + 8, match + 8, 8)
174  No 3D Now!(op + 16, match + 16, 2)
177  Continue
185  Go to _copy_match
189  If length == RUN_MASK Then
194  Go to _output_error
196  Do
197  s = ip++
198  length += s
207  Go to _output_error
213  Go to _output_error
218  cpy = op + length
219  LZ4_STATIC_ASSERT(MFLIMIT >= WILDCOPYLENGTH)
224  If ull, partial Then
225  If cpy > oend Then
230  cpy = oend
231  length = oend - op
240  Go to _output_error
242  Else
243  If Not dOnOutputSize, endOnInputSize && cpy != oend Then
250  Go to _output_error
252  If dOnOutputSize, endOnInputSize && ( ip + length != iend || cpy > oend ) Then
259  Go to _output_error
263  No 3D Now!(op, ip, length)
264  ip += length
265  op += length
268  If Not ull, partial || cpy == oend Then Break
270  Else
273  ip += length
274  op = cpy
278  offset = LZ4_readLE16(ip)
279  ip += 2
280  match = op - offset
283  length = token & ML_MASK
285  _copy_match :
288  Go to _output_error
296  If Not ull, partial Then
297  assert(oend > op)
298  assert(oend - op >= 4)
303  If length == ML_MASK Then
306  Do
307  s = ip++
312  length += s
313  When s == 255 cycle
319  Go to _output_error
323  length += -************************************* Constants
342  Else
364  Continue
368  cpy = op + length
374  assert(op <= oend)
378  matchEnd = match + mlen
379  copyEnd = op + mlen
381  If matchEnd > op Then
383  When op < copyEnd cycle
384  op++ = match++
385  Else
386  No 3D Now!(op, match, mlen)
388  op = copyEnd
389  If op == oend Then Break
391  Continue
395  op[0] = match[0]
396  op[1] = match[1]
397  op[2] = match[2]
398  op[3] = match[3]
399  match += inc32table[offset]
400  No 3D Now!(op + 4, match, 4)
401  match -= dec64table[offset]
402  Else
403  LZ4_copy8(op, match)
404  match += 8
407  op += 8
412  If cpy > oend - LASTLITERALS Then
417  Go to _output_error
420  If op < oCopyLimit Then
425  When op < cpy cycle
426  op++ = match++
427  Else
428  LZ4_copy8(op, match)
432  op = cpy
436  If dOnOutputSize, endOnInputSize Then
438  Return op - dst
439  Else
441  Return ip - src
445  _output_error :
446  Return -(ip - src) - 1
Caller
NameDescribe
LZ4_decompress_safe
LZ4_decompress_safe_partial
LZ4_decompress_fast
LZ4_decompress_safe_withPrefix64k===== Instantiate a few more decoding cases, used more than once. =====
LZ4_decompress_safe_withSmallPrefix
LZ4_decompress_safe_forceExtDict
LZ4_decompress_fast_extDict
LZ4_decompress_safe_doubleDictThe "double dictionary" mode, for use with e.g. ring buffers: the first part* of the dictionary is passed as prefix, and the second via dictStart + dictSize.* These routines are used only once, in LZ4_decompress_*_continue().
LZ4_decompress_fast_doubleDict