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

Name:FSE_writeNCount_generic

Proto:static size_t FSE_writeNCount_generic(void *header, size_t headerBufferSize, const short *normalizedCounter, unsigned maxSymbolValue, unsigned tableLog, unsigned writeIsSafe)

Type:size_t

Parameter:

TypeParameterName
void *header
size_theaderBufferSize
const short *normalizedCounter
unsignedmaxSymbolValue
unsignedtableLog
unsignedwriteIsSafe
206  ostart = header
207  out = ostart
208  oend = ostart + headerBufferSize
210  tableSize = 1 << tableLog
215  charnum = 0
216  previous0 = 0
218  bitStream = 0
219  bitCount = 0
221  bitStream += tableLog - FSE_MIN_TABLELOG << bitCount
222  bitCount += 4
225  remaining = tableSize + 1
226  threshold = tableSize
227  nbBits = tableLog + 1
229  When remaining > 1 cycle
230  If previous0 Then
231  start = charnum
232  When Not normalizedCounter[charnum] cycle
233  charnum++
234  When charnum >= start + 24 cycle
235  start += 24
236  bitStream += 0xFFFFU << bitCount
239  out[0] = bitStream
240  out[1] = bitStream >> 8
241  out += 2
242  bitStream >>= 16
244  When charnum >= start + 3 cycle
245  start += 3
246  bitStream += 3 << bitCount
247  bitCount += 2
250  bitCount += 2
251  If bitCount > 16 Then
254  out[0] = bitStream
255  out[1] = bitStream >> 8
256  out += 2
257  bitStream >>= 16
258  bitCount -= 16
263  max = 2 * threshold - 1 - remaining
264  remaining -= If count < 0 Then -count Else count
265  count++
266  If count >= threshold Then count += max
268  bitStream += count << bitCount
269  bitCount += nbBits
270  bitCount -= count < max
271  previous0 = count == 1
274  When remaining < threshold cycle
275  nbBits--, threshold >>= 1
277  If bitCount > 16 Then
280  out[0] = bitStream
281  out[1] = bitStream >> 8
282  out += 2
283  bitStream >>= 16
284  bitCount -= 16
289  If Not writeIsSafe && out > oend - 2 Then Return -***************************************** Error codes handling(dstSize_tooSmall)
291  out[0] = bitStream
292  out[1] = bitStream >> 8
293  out += (bitCount + 7) / 8
295  If charnum > maxSymbolValue + 1 Then Return -***************************************** Error codes handling(GENERIC)
298  Return out - ostart
Caller
NameDescribe
FSE_writeNCount