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:23
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:HUF_readCTable_wksp

Proto:size_t HUF_readCTable_wksp(HUF_CElt *CTable, U32 maxSymbolValue, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)

Type:size_t

Parameter:

TypeParameterName
HUF_CElt *CTable
U32maxSymbolValue
const void *src
size_tsrcSize
void *workspace
size_tworkspaceSize
207  tableLog = 0
208  nbSymbols = 0
210  spaceUsed32 = 0
212  rankVal = workspace + spaceUsed32
213  spaceUsed32 += absolute limit of HUF_MAX_TABLELOG. Beyond that value, code does not work + 1
214  huffWeight = workspace + spaceUsed32
215  spaceUsed32 += @a is a power of 2 value (HUF_SYMBOLVALUE_MAX + 1, sizeof(U32)) >> 2
217  If spaceUsed32 << 2 > workspaceSize Then Return -***************************************** Error codes handling(tableLog_tooLarge)
219  workspace = workspace + spaceUsed32
220  workspaceSize -= spaceUsed32 << 2
223  readSize = : size read from `src` , or an error Code .
224  If ERR_isError(readSize) Then Return readSize
228  If tableLog > max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG Then Return -***************************************** Error codes handling(tableLog_tooLarge)
230  If nbSymbols > maxSymbolValue + 1 Then Return -***************************************** Error codes handling(maxSymbolValue_tooSmall)
235  nextRankStart = 0
236  When n <= tableLog cycle
238  nextRankStart += rankVal[n] << n - 1
239  rankVal[n] = curr
246  When n < nbSymbols cycle
247  w = huffWeight[n]
248  nbBits = tableLog + 1 - w
254  U16 nbPerRank[14] = {0}
255  U16 valPerRank[14] = {0}
258  When n < nbSymbols cycle nbPerRank[nbBits]++
262  valPerRank[tableLog + 1] = 0
264  min = 0
266  When n > 0 cycle
267  valPerRank[n] = min
268  min += nbPerRank[n]
269  min >>= 1
275  When n <= maxSymbolValue cycle val = valPerRank[nbBits]++
280  Return readSize
Caller
NameDescribe
ZSTD_loadZstdDictionary : 0, or an error code