Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:ZSTD_insertBtAndFindBestMatch

Proto:static size_t ZSTD_insertBtAndFindBestMatch(ZSTD_CCtx *zc, const BYTE *const ip, const BYTE *const iend, size_t *offsetPtr, U32 nbCompares, const U32 mls, U32 extDict)

Type:size_t

Parameter:

TypeParameterName
ZSTD_CCtx *zc
const BYTE *constip
const BYTE *constiend
size_t *offsetPtr
U32nbCompares
const U32mls
U32extDict
1646  hashTable = hashTable
1647  hashLog = hashLog
1648  h = ZSTD_hashPtr(ip, hashLog, mls)
1649  bt = chainTable
1650  btLog = chainLog - 1
1651  btMask = (1 << btLog) - 1
1652  matchIndex = hashTable[h]
1653  commonLengthSmaller = 0 , commonLengthLarger = 0
1654  base = base
1655  dictBase = dictBase
1656  dictLimit = dictLimit
1657  dictEnd = dictBase + dictLimit
1658  prefixStart = base + dictLimit
1659  curr = ip - base
1660  btLow = If btMask >= curr Then 0 Else curr - btMask
1661  windowLow = lowLimit
1662  smallerPtr = bt + 2 * (curr & btMask)
1663  largerPtr = bt + 2 * (curr & btMask) + 1
1664  matchEndIdx = curr + 8
1666  bestLength = 0
1668  hashTable[h] = curr
1670  When nbCompares-- && matchIndex > windowLow cycle
1671  nextPtr = bt + 2 * (matchIndex & btMask)
1672  matchLength = -************************************** shared macros(commonLengthSmaller, commonLengthLarger)
1675  If Not extDict || matchIndex + matchLength >= dictLimit Then
1676  match = base + matchIndex
1679  Else
1686  If matchLength > bestLength Then
1691  If ip + matchLength == iend Then Break
1695  If match[matchLength] < ip[matchLength] Then
1699  If matchIndex <= btLow Then
1700  smallerPtr = dummy32
1701  Break
1703  smallerPtr = nextPtr + 1
1704  matchIndex = nextPtr[1]
1705  Else
1709  If matchIndex <= btLow Then
1710  largerPtr = dummy32
1711  Break
1713  largerPtr = nextPtr
1714  matchIndex = nextPtr[0]
1718  smallerPtr = largerPtr = 0
1720  nextToUpdate = If matchEndIdx > curr + 8 Then matchEndIdx - 8 Else curr + 1
1721  Return bestLength
Caller
NameDescribe
ZSTD_BtFindBestMatchZSTD_BtFindBestMatch() : Tree updater, providing best match
ZSTD_BtFindBestMatch_extDictTree updater, providing best match