mirror of
https://github.com/facebook/zstd.git
synced 2025-12-07 00:02:39 -05:00
Adjust match backwards count args
This commit is contained in:
parent
bf0d559449
commit
3f99c9b38d
@ -161,17 +161,15 @@ static size_t ZSTD_ldm_countBackwardsMatch(
|
|||||||
* On reaching `pMatchBase`, start counting from mEnd */
|
* On reaching `pMatchBase`, start counting from mEnd */
|
||||||
static size_t ZSTD_ldm_countBackwardsMatch_2segments(
|
static size_t ZSTD_ldm_countBackwardsMatch_2segments(
|
||||||
const BYTE* pIn, const BYTE* pAnchor,
|
const BYTE* pIn, const BYTE* pAnchor,
|
||||||
const BYTE* pMatch, const BYTE* pMatchBase, const BYTE* mEnd)
|
const BYTE* pMatch, const BYTE* pMatchBase, const BYTE* dictStart, const BYTE* mEnd)
|
||||||
{
|
{
|
||||||
const BYTE* const vBegin = MAX(pIn - (pMatch - pMatchBase), pAnchor);
|
size_t const matchLength = ZSTD_ldm_countBackwardsMatch(pIn, pAnchor, pMatch, pMatchBase);
|
||||||
size_t const matchLength = ZSTD_ldm_countBackwardsMatch(pIn, vBegin, pMatch, pMatchBase);
|
if (pMatch - matchLength != pMatchBase || pMatchBase == dictStart) {
|
||||||
if (pMatch - matchLength != pMatchBase) {
|
|
||||||
return matchLength;
|
return matchLength;
|
||||||
}
|
}
|
||||||
DEBUGLOG(7, "ZSTD_ldm_countBackwardsMatch_2segments: found a 2-parts backwards match (current length==%zu)", matchLength);
|
DEBUGLOG(7, "ZSTD_ldm_countBackwardsMatch_2segments: found a 2-parts backwards match (current length==%zu)", matchLength);
|
||||||
DEBUGLOG(7, "distance from pMatch to start = %zi", pMatch - pMatchBase);
|
|
||||||
DEBUGLOG(7, "final backwards match length = %zu", matchLength + ZSTD_ldm_countBackwardsMatch(pIn - matchLength, pAnchor, mEnd, pMatchBase));
|
DEBUGLOG(7, "final backwards match length = %zu", matchLength + ZSTD_ldm_countBackwardsMatch(pIn - matchLength, pAnchor, mEnd, pMatchBase));
|
||||||
return matchLength + ZSTD_ldm_countBackwardsMatch(pIn - matchLength, pAnchor, mEnd, pMatchBase);
|
return matchLength + ZSTD_ldm_countBackwardsMatch(pIn - matchLength, pAnchor, mEnd, dictStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** ZSTD_ldm_fillFastTables() :
|
/** ZSTD_ldm_fillFastTables() :
|
||||||
@ -350,7 +348,7 @@ static size_t ZSTD_ldm_generateSequences_internal(
|
|||||||
}
|
}
|
||||||
curBackwardMatchLength =
|
curBackwardMatchLength =
|
||||||
ZSTD_ldm_countBackwardsMatch_2segments(ip, anchor, pMatch,
|
ZSTD_ldm_countBackwardsMatch_2segments(ip, anchor, pMatch,
|
||||||
lowMatchPtr, dictEnd);
|
lowMatchPtr, dictStart, dictEnd);
|
||||||
curTotalMatchLength = curForwardMatchLength +
|
curTotalMatchLength = curForwardMatchLength +
|
||||||
curBackwardMatchLength;
|
curBackwardMatchLength;
|
||||||
} else { /* !extDict */
|
} else { /* !extDict */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user