Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:ZSTD_compressLiterals

Proto:static size_t ZSTD_compressLiterals(ZSTD_CCtx *zc, void *dst, size_t dstCapacity, const void *src, size_t srcSize)

Type:size_t

Parameter:

TypeParameterName
ZSTD_CCtx *zc
void *dst
size_tdstCapacity
const void *src
size_tsrcSize
484  minGain = ZSTD_minGain(srcSize)
485  size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB)
486  ostart = dst
487  singleStream = srcSize < 256
488  hType = set_compressed
494  minLitSize = If flagStaticHufTable == HUF_repeat_valid Then 6 Else small ? don't even attempt compression (speed opt)
495  If srcSize <= minLitSize Then Return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize)
499  If dstCapacity < lhSize + 1 Then Return -***************************************** Error codes handling(dstSize_tooSmall)
502  repeat = flagStaticHufTable
503  preferRepeat = If strategy < ZSTD_lazy Then srcSize <= 1024 Else 0
504  If repeat == HUF_repeat_valid && lhSize == 3 Then singleStream = 1
506  cLitSize = If singleStream Then HUF_compress1X_repeat(ostart + lhSize, dstCapacity - lhSize, src, srcSize, 255, 11, tmpCounters, size of tmpCounters , hufTable, & repeat, preferRepeat) Else HUF_compress4X_repeat(ostart + lhSize, dstCapacity - lhSize, src, srcSize, 255, 11, tmpCounters, size of tmpCounters , hufTable, & repeat, preferRepeat)
511  hType = set_repeat
513  Else
518  If cLitSize == 0 | cLitSize >= srcSize - minGain Then
519  flagStaticHufTable = *< Cannot use the previous table
520  Return ZSTD_noCompressLiterals(dst, dstCapacity, src, srcSize)
522  If cLitSize == 1 Then
523  flagStaticHufTable = *< Cannot use the previous table
524  Return ZSTD_compressRleLiteralsBlock(dst, dstCapacity, src, srcSize)
529  Case lhSize == 3
531  lhc = hType + ( Not singleStream << 2) + (srcSize << 4) + (cLitSize << 14)
533  Break
535  Case lhSize == 4
537  lhc = hType + (2 << 2) + (srcSize << 4) + (cLitSize << 18)
538  ZSTD_writeLE32(ostart, lhc)
539  Break
541  Default
542  Case lhSize == 5
544  lhc = hType + (3 << 2) + (srcSize << 4) + (cLitSize << 22)
545  ZSTD_writeLE32(ostart, lhc)
546  ostart[4] = cLitSize >> 10
547  Break
550  Return lhSize + cLitSize
Caller
NameDescribe
ZSTD_compressSequences_internal