Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name: : size read from `src` , or an error Code .

Proto:size_t HUF_readStats_wksp(BYTE *huffWeight, size_t hwSize, U32 *rankStats, U32 *nbSymbolsPtr, U32 *tableLogPtr, const void *src, size_t srcSize, void *workspace, size_t workspaceSize)

Type:size_t

Parameter:

TypeParameterName
BYTE *huffWeight
size_thwSize
U32 *rankStats
U32 *nbSymbolsPtr
U32 *tableLogPtr
const void *src
size_tsrcSize
void *workspace
size_tworkspaceSize

Brief:! HUF_readStats() :Read compact Huffman tree, saved by HUF_writeCTable().`huffWeight` is destination buffer.`rankStats` is assumed to be a table of at least HUF_TABLELOG_MAX U32.Note : Needed by HUF_readCTable() and HUF_readDTableX?() .

170  ip = src
174  If Not srcSize Then Return -***************************************** Error codes handling(srcSize_wrong)
176  iSize = ip[0]
179  If iSize >= 128 Then
180  oSize = iSize - 127
181  iSize = (oSize + 1) / 2
182  If iSize + 1 > srcSize Then Return -***************************************** Error codes handling(srcSize_wrong)
184  If oSize >= hwSize Then Return -***************************************** Error codes handling(corruption_detected)
186  ip += 1
189  When n < oSize cycle
190  huffWeight[n] = ip[n / 2] >> 4
191  huffWeight[n + 1] = ip[n / 2] & 15
194  Else
195  If iSize + 1 > srcSize Then Return -***************************************** Error codes handling(srcSize_wrong)
197  oSize = FSE_decompress_wksp(huffWeight, hwSize - 1, ip + 1, iSize, 6, workspace, workspaceSize)
198  If === Error Management === Then Return oSize
203  memset(rankStats, 0, (max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG + 1) * sizeof(U32))
204  weightTotal = 0
207  When n < oSize cycle
210  rankStats[huffWeight[n]]++
211  weightTotal += 1 << huffWeight[n] >> 1
214  If weightTotal == 0 Then Return -***************************************** Error codes handling(corruption_detected)
219  tableLog = -*************************************************************** Internal functions + 1
220  If tableLog > max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG Then Return -***************************************** Error codes handling(corruption_detected)
225  total = 1 << tableLog
226  rest = total - weightTotal
237  If rankStats[1] < 2 || rankStats[1] & 1 Then Return -***************************************** Error codes handling(corruption_detected)
241  nbSymbolsPtr = oSize + 1
242  Return iSize + 1
Caller
NameDescribe
HUF_readDTableX2_wksp
HUF_readDTableX4_wksp
HUF_readCTable_wksp