Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name: : size of saved CTable

Proto:size_t HUF_writeCTable_wksp(void *dst, size_t maxDstSize, const HUF_CElt *CTable, U32 maxSymbolValue, U32 huffLog, void *workspace, size_t workspaceSize)

Type:size_t

Parameter:

TypeParameterName
void *dst
size_tmaxDstSize
const HUF_CElt *CTable
U32maxSymbolValue
U32huffLog
void *workspace
size_tworkspaceSize

Brief:! HUF_writeCTable_wksp() :`CTable` : Huffman tree to save, using huf representation.

154  op = dst
159  spaceUsed32 = 0
161  bitsToWeight = workspace + spaceUsed32
162  spaceUsed32 += @a is a power of 2 value (max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG + 1, sizeof(U32)) >> 2
163  huffWeight = workspace + spaceUsed32
164  spaceUsed32 += @a is a power of 2 value (HUF_SYMBOLVALUE_MAX, sizeof(U32)) >> 2
166  If spaceUsed32 << 2 > workspaceSize Then Return -***************************************** Error codes handling(tableLog_tooLarge)
168  workspace = workspace + spaceUsed32
169  workspaceSize -= spaceUsed32 << 2
172  If maxSymbolValue > HUF_SYMBOLVALUE_MAX Then Return -***************************************** Error codes handling(maxSymbolValue_tooLarge)
176  bitsToWeight[0] = 0
177  When n < huffLog + 1 cycle bitsToWeight[n] = huffLog + 1 - n
179  When n < maxSymbolValue cycle huffWeight[n] = bitsToWeight[nbBits]
184  CHECK_V_F(hSize, HUF_compressWeights_wksp(op + 1, maxDstSize - 1, huffWeight, maxSymbolValue, workspace, workspaceSize))
185  If hSize > 1 & hSize < maxSymbolValue / 2 Then
186  op[0] = hSize
187  Return hSize + 1
192  If maxSymbolValue > 256 - 128 Then Return -***************************************** Error codes handling(GENERIC)
194  If (maxSymbolValue + 1) / 2 + 1 > maxDstSize Then Return -***************************************** Error codes handling(dstSize_tooSmall)
196  op[0] = 128 + maxSymbolValue - 1
197  huffWeight[maxSymbolValue] = 0
198  When n < maxSymbolValue cycle op[(n / 2) + 1] = (huffWeight[n] << 4) + huffWeight[n + 1]
200  Return (maxSymbolValue + 1) / 2 + 1
Caller
NameDescribe
HUF_compress_internal`workSpace` must a table of at least 1024 unsigned