Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:-******************************* *_destSize() variant

Proto:static int LZ4_compress_destSize_generic(LZ4_stream_t_internal *const ctx, const char *const src, char *const dst, int *const srcSizePtr, const int targetDstSize, const tableType_t tableType)

Type:int

Parameter:

TypeParameterName
LZ4_stream_t_internal *constctx
const char *constsrc
char *constdst
int *constsrcSizePtr
const inttargetDstSize
const tableType_ttableType
530  ip = src
531  base = src
532  lowLimit = src
533  anchor = ip
534  iend = ip + srcSizePtr
535  mflimit = iend - MFLIMIT
536  matchlimit = iend - LASTLITERALS
538  op = dst
539  oend = op + targetDstSize
540  oMaxLit = op + targetDstSize - 2 - 8 - 1
542  oMaxMatch = op + targetDstSize - LASTLITERALS + 1
544  oMaxSeq = oMaxLit - 1
550  If targetDstSize < 1 Then Return 0
553  If ((U32) * srcSizePtr > 2 113 929 216 bytes ) Then Return 0
556  If tableType == byU16 && srcSizePtr >= LZ4_64Klimit Then Return 0
559  If srcSizePtr < LZ4_minLength Then Go to _last_literals
563  srcSizePtr = 0
564  LZ4_putPosition(ip, hashTable, tableType, base)
565  ip++
565  forwardH = LZ4_hashPosition(ip, tableType)
568  cycle
574  forwardIp = ip
575  step = 1
578  Do
596  When If tableType == byU16 Then 0 Else match + MAX_DISTANCE < ip || LZ4_read32(match) != LZ4_read32(ip) cycle
606  ip--
607  match--
612  litLength = ip - anchor
614  token = op++
615  If op + (litLength + 240) / 255 + litLength > oMaxLit Then
618  op--
619  Go to _last_literals
621  If litLength >= RUN_MASK Then
622  len = litLength - RUN_MASK
623  token = RUN_MASK << ML_BITS
624  When len >= 255 cycle op++ = 255
626  op++ = len
627  Else token = litLength << ML_BITS
632  op += litLength
635  _next_match :
637  LZ4_writeLE16(op, (U16)(ip - match))
637  op += 2
644  If op + (matchLength + 240) / 255 > oMaxMatch Then
646  matchLength = 15 - 1 + (oMaxMatch - op) * 255
650  If matchLength >= ML_MASK Then
651  token += ML_MASK
652  matchLength -= ML_MASK
653  When matchLength >= 255 cycle
654  matchLength -= 255
655  op++ = 255
657  op++ = matchLength
658  Else token += matchLength
662  anchor = ip
665  If ip > mflimit Then Break
667  If op > oMaxSeq Then Break
671  LZ4_putPosition(ip - 2, hashTable, tableType, base)
674  match = LZ4_getPosition(ip, hashTable, tableType, base)
675  LZ4_putPosition(ip, hashTable, tableType, base)
677  If match + MAX_DISTANCE >= ip && LZ4_read32(match) == LZ4_read32(ip) Then
679  token = op++
679  token = 0
680  Go to _next_match
684  forwardH = LZ4_hashPosition(++ip, tableType)
687  _last_literals :
690  lastRunSize = iend - anchor
692  If op + 1 + (lastRunSize + 240) / 255 + lastRunSize > oend Then
696  lastRunSize = oend - op - 1
697  lastRunSize -= (lastRunSize + 240) / 255
699  ip = anchor + lastRunSize
701  If lastRunSize >= RUN_MASK Then
704  op++ = RUN_MASK << ML_BITS
705  When accumulator >= 255 cycle op++ = 255
707  op++ = accumulator
708  Else
709  op++ = lastRunSize << ML_BITS
711  No 3D Now!(op, anchor, lastRunSize)
712  op += lastRunSize
716  srcSizePtr = ip - src
717  Return op - dst
Caller
NameDescribe
LZ4_compress_destSize_extState