Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:-************************************** Binary Tree search

Proto:static U32 ZSTD_insertBtAndGetAllMatches(ZSTD_CCtx *zc, const BYTE *const ip, const BYTE *const iLimit, U32 nbCompares, const U32 mls, U32 extDict, ZSTD_match_t *matches, const U32 minMatchLen)

Type:U32

Parameter:

TypeParameterName
ZSTD_CCtx *zc
const BYTE *constip
const BYTE *constiLimit
U32nbCompares
const U32mls
U32extDict
ZSTD_match_t *matches
const U32minMatchLen
238  base = base
239  curr = ip - base
240  hashLog = hashLog
241  h = ZSTD_hashPtr(ip, hashLog, mls)
242  hashTable = hashTable
243  matchIndex = hashTable[h]
244  bt = chainTable
245  btLog = chainLog - 1
246  btMask = (1U << btLog) - 1
247  commonLengthSmaller = 0 , commonLengthLarger = 0
248  dictBase = dictBase
249  dictLimit = dictLimit
250  dictEnd = dictBase + dictLimit
251  prefixStart = base + dictLimit
252  btLow = If btMask >= curr Then 0 Else curr - btMask
253  windowLow = lowLimit
254  smallerPtr = bt + 2 * (curr & btMask)
255  largerPtr = bt + 2 * (curr & btMask) + 1
256  matchEndIdx = curr + 8
258  mnum = 0
260  minMatch = If mls == 3 Then 3 Else 4
261  bestLength = minMatchLen - 1
263  If minMatch == 3 Then
264  matchIndex3 = ZSTD_insertAndFindFirstIndexHash3(zc, ip)
265  If matchIndex3 > windowLow && curr - matchIndex3 < 1 << 18 Then
267  currMl = 0
268  If Not extDict || matchIndex3 >= dictLimit Then
272  Else
280  If currMl > bestLength Then
293  hashTable[h] = curr
295  When nbCompares-- && matchIndex > windowLow cycle
296  nextPtr = bt + 2 * (matchIndex & btMask)
297  matchLength = -************************************** shared macros(commonLengthSmaller, commonLengthLarger)
300  If Not extDict || matchIndex + matchLength >= dictLimit Then
301  match = base + matchIndex
302  If match[matchLength] == ip[matchLength] Then
305  Else
312  If matchLength > bestLength Then
317  len = matchLength
318  mnum++
321  If ip + matchLength == iLimit Then Break
325  If match[matchLength] < ip[matchLength] Then
329  If matchIndex <= btLow Then
331  Break
333  smallerPtr = nextPtr + 1
334  matchIndex = nextPtr[1]
335  Else
339  If matchIndex <= btLow Then
340  largerPtr = dummy32
341  Break
343  largerPtr = nextPtr
344  matchIndex = nextPtr[0]
348  smallerPtr = largerPtr = 0
350  update :
351  nextToUpdate = If matchEndIdx > curr + 8 Then matchEndIdx - 8 Else curr + 1
352  Return mnum