Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:FSE_buildCTable_wksp() :* Same as FSE_buildCTable(), but using an externally allocated scratch buffer (`workSpace`)

Proto:size_t FSE_buildCTable_wksp(FSE_CTable *ct, const short *normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, void *workspace, size_t workspaceSize)

Type:size_t

Parameter:

TypeParameterName
FSE_CTable *ct
const short *normalizedCounter
unsignedmaxSymbolValue
unsignedtableLog
void *workspace
size_tworkspaceSize
94  tableSize = 1 << tableLog
95  tableMask = tableSize - 1
96  ptr = ct
97  tableU16 = ptr + 2
98  FSCT = ptr + 1 + If tableLog Then tableSize >> 1 Else 1
99  symbolTT = FSCT
100  step = FSE_TABLESTEP(tableSize)
101  highThreshold = tableSize - 1
104  mplate functions type & suffix * tableSymbol
105  spaceUsed32 = 0
107  cumul = workspace + spaceUsed32
108  spaceUsed32 += !FSE_MAX_SYMBOL_VALUE :* Maximum symbol value authorized.* Required for proper stack allocation + 2
109  tableSymbol * mplate functions type & suffix = workspace + spaceUsed32
110  spaceUsed32 += @a is a power of 2 value ( size of mplate functions type & suffix * ((size_t)1 << tableLog), sizeof(U32)) >> 2
112  If spaceUsed32 << 2 > workspaceSize Then Return -***************************************** Error codes handling(tableLog_tooLarge)
114  workspace = workspace + spaceUsed32
115  workspaceSize -= spaceUsed32 << 2
118  tableU16[ - 2] = tableLog
119  tableU16[ - 1] = maxSymbolValue
127  cumul[0] = 0
128  When u <= maxSymbolValue + 1 cycle
129  If normalizedCounter[u - 1] == -1 Then
130  cumul[u] = cumul[u - 1] + 1
132  Else
133  cumul[u] = cumul[u - 1] + normalizedCounter[u - 1]
136  cumul[maxSymbolValue + 1] = tableSize + 1
141  position = 0
143  When symbol <= maxSymbolValue cycle
153  If position != 0 Then Return -***************************************** Error codes handling(GENERIC)
160  When u < tableSize cycle
162  tableU16[cumul[s]++] = tableSize + u
168  total = 0
170  When s <= maxSymbolValue cycle
172  Case normalizedCounter[s] == 0
172  Break
174  Case normalizedCounter[s] == -1
175  Case normalizedCounter[s] == 1
176  deltaNbBits = (tableLog << 16) - (1 << tableLog)
177  deltaFindState = total - 1
178  total++
179  Break
180  Default
191  Return 0
Caller
NameDescribe
HUF_compressWeights_wksp
ZSTD_compressSequences_internal
ZSTD_loadZstdDictionary : 0, or an error code