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

Name:HUF_buildCTable_wksp

Proto:size_t HUF_buildCTable_wksp(HUF_CElt *tree, const U32 *count, U32 maxSymbolValue, U32 maxNbBits, void *workSpace, size_t wkspSize)

Type:size_t

Parameter:

TypeParameterName
HUF_CElt *tree
const U32 *count
U32maxSymbolValue
U32maxNbBits
void *workSpace
size_twkspSize
422  huffNode0 = workSpace
423  huffNode = huffNode0 + 1
426  nodeNb = HUF_buildCTable_wksp() :* Same as HUF_buildCTable(), but using externally allocated scratch buffer.* `workSpace` must be aligned on 4-bytes boundaries, and be at least as large as a table of 1024 unsigned.
430  If wkspSize < sizeof(huffNodeTable) Then Return -***************************************** Error codes handling(GENERIC)
432  If maxNbBits == 0 Then maxNbBits = ableLog by default, when not specified
434  If maxSymbolValue > HUF_SYMBOLVALUE_MAX Then Return -***************************************** Error codes handling(GENERIC)
436  memset(huffNode0, 0, sizeof(huffNodeTable))
439  HUF_sort(huffNode, count, maxSymbolValue)
442  nonNullRank = maxSymbolValue
443  When count == 0 cycle
444  nonNullRank--
445  lowS = nonNullRank
446  nodeRoot = nodeNb + lowS - 1
447  lowN = nodeNb
448  count = count + count
449  parent = parent = nodeNb
450  nodeNb++
451  lowS -= 2
452  When n <= nodeRoot cycle count = 1U << 30
454  count = 1U << 31
457  When nodeNb <= nodeRoot cycle
458  n1 = If count < count Then lowS-- Else lowN++
459  n2 = If count < count Then lowS-- Else lowN++
460  count = count + count
461  parent = parent = nodeNb
462  nodeNb++
466  nbBits = 0
467  When n >= HUF_buildCTable_wksp() :* Same as HUF_buildCTable(), but using externally allocated scratch buffer.* `workSpace` must be aligned on 4-bytes boundaries, and be at least as large as a table of 1024 unsigned. cycle nbBits = nbBits + 1
469  When n <= nonNullRank cycle nbBits = nbBits + 1
473  maxNbBits = HUF_setMaxHeight(huffNode, nonNullRank, maxNbBits)
477  U16 nbPerRank[13] = {0}
478  U16 valPerRank[13] = {0}
479  If maxNbBits > max configured tableLog (for static allocation); can be modified up to HUF_ABSOLUTEMAX_TABLELOG Then Return -***************************************** Error codes handling(GENERIC)
481  When n <= nonNullRank cycle nbPerRank[nbBits]++
485  min = 0
486  When n > 0 cycle
487  valPerRank[n] = min
488  min += nbPerRank[n]
489  min >>= 1
492  When n <= maxSymbolValue cycle nbBits = nbBits
494  When n <= maxSymbolValue cycle val = valPerRank[nbBits]++
498  Return maxNbBits
Caller
NameDescribe
HUF_compress_internal`workSpace` must a table of at least 1024 unsigned