mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
changed function name to ZSTD_DUBT_findBestMatch()
This commit is contained in:
@ -165,7 +165,7 @@ static void ZSTD_insertDUBT1(ZSTD_CCtx* zc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static size_t ZSTD_insertBtAndFindBestMatch (
|
static size_t ZSTD_DUBT_findBestMatch (
|
||||||
ZSTD_CCtx* zc,
|
ZSTD_CCtx* zc,
|
||||||
const BYTE* const ip, const BYTE* const iend,
|
const BYTE* const ip, const BYTE* const iend,
|
||||||
size_t* offsetPtr,
|
size_t* offsetPtr,
|
||||||
@ -192,14 +192,14 @@ static size_t ZSTD_insertBtAndFindBestMatch (
|
|||||||
U32 nbCandidates = nbCompares;
|
U32 nbCandidates = nbCompares;
|
||||||
U32 previousCandidate = 0;
|
U32 previousCandidate = 0;
|
||||||
|
|
||||||
DEBUGLOG(7, "ZSTD_insertBtAndFindBestMatch (%u) ", current);
|
DEBUGLOG(7, "ZSTD_DUBT_findBestMatch (%u) ", current);
|
||||||
assert(ip <= iend-8); /* required for h calculation */
|
assert(ip <= iend-8); /* required for h calculation */
|
||||||
|
|
||||||
/* reach end of unsorted candidates list */
|
/* reach end of unsorted candidates list */
|
||||||
while ( (matchIndex > unsortLimit)
|
while ( (matchIndex > unsortLimit)
|
||||||
&& (*unsortedMark == ZSTD_DUBT_UNSORTED_MARK)
|
&& (*unsortedMark == ZSTD_DUBT_UNSORTED_MARK)
|
||||||
&& (nbCandidates > 1) ) {
|
&& (nbCandidates > 1) ) {
|
||||||
DEBUGLOG(8, "ZSTD_insertBtAndFindBestMatch: candidate %u is unsorted",
|
DEBUGLOG(8, "ZSTD_DUBT_findBestMatch: candidate %u is unsorted",
|
||||||
matchIndex);
|
matchIndex);
|
||||||
*unsortedMark = previousCandidate;
|
*unsortedMark = previousCandidate;
|
||||||
previousCandidate = matchIndex;
|
previousCandidate = matchIndex;
|
||||||
@ -211,7 +211,7 @@ static size_t ZSTD_insertBtAndFindBestMatch (
|
|||||||
|
|
||||||
if ( (matchIndex > unsortLimit)
|
if ( (matchIndex > unsortLimit)
|
||||||
&& (*unsortedMark==ZSTD_DUBT_UNSORTED_MARK) ) {
|
&& (*unsortedMark==ZSTD_DUBT_UNSORTED_MARK) ) {
|
||||||
DEBUGLOG(7, "ZSTD_insertBtAndFindBestMatch: nullify last unsorted candidate %u",
|
DEBUGLOG(7, "ZSTD_DUBT_findBestMatch: nullify last unsorted candidate %u",
|
||||||
matchIndex);
|
matchIndex);
|
||||||
*nextCandidate = *unsortedMark = 0; /* nullify next candidate if it's still unsorted (note : simplification, detrimental to compression ratio, beneficial for speed) */
|
*nextCandidate = *unsortedMark = 0; /* nullify next candidate if it's still unsorted (note : simplification, detrimental to compression ratio, beneficial for speed) */
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ static size_t ZSTD_insertBtAndFindBestMatch (
|
|||||||
zc->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */
|
zc->nextToUpdate = matchEndIdx - 8; /* skip repetitive patterns */
|
||||||
if (bestLength >= MINMATCH) {
|
if (bestLength >= MINMATCH) {
|
||||||
U32 const mIndex = current - ((U32)*offsetPtr - ZSTD_REP_MOVE); (void)mIndex;
|
U32 const mIndex = current - ((U32)*offsetPtr - ZSTD_REP_MOVE); (void)mIndex;
|
||||||
DEBUGLOG(8, "ZSTD_insertBtAndFindBestMatch(%u) : found match of length %u and offsetCode %u (pos %u)",
|
DEBUGLOG(8, "ZSTD_DUBT_findBestMatch(%u) : found match of length %u and offsetCode %u (pos %u)",
|
||||||
current, (U32)bestLength, (U32)*offsetPtr, mIndex);
|
current, (U32)bestLength, (U32)*offsetPtr, mIndex);
|
||||||
}
|
}
|
||||||
return bestLength;
|
return bestLength;
|
||||||
@ -307,7 +307,7 @@ static size_t ZSTD_BtFindBestMatch (
|
|||||||
DEBUGLOG(7, "ZSTD_BtFindBestMatch");
|
DEBUGLOG(7, "ZSTD_BtFindBestMatch");
|
||||||
if (ip < zc->base + zc->nextToUpdate) return 0; /* skipped area */
|
if (ip < zc->base + zc->nextToUpdate) return 0; /* skipped area */
|
||||||
ZSTD_updateDUBT(zc, ip, iLimit, mls);
|
ZSTD_updateDUBT(zc, ip, iLimit, mls);
|
||||||
return ZSTD_insertBtAndFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, mls, 0);
|
return ZSTD_DUBT_findBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, mls, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ static size_t ZSTD_BtFindBestMatch_extDict (
|
|||||||
DEBUGLOG(7, "ZSTD_BtFindBestMatch_extDict");
|
DEBUGLOG(7, "ZSTD_BtFindBestMatch_extDict");
|
||||||
if (ip < zc->base + zc->nextToUpdate) return 0; /* skipped area */
|
if (ip < zc->base + zc->nextToUpdate) return 0; /* skipped area */
|
||||||
ZSTD_updateDUBT(zc, ip, iLimit, mls);
|
ZSTD_updateDUBT(zc, ip, iLimit, mls);
|
||||||
return ZSTD_insertBtAndFindBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, mls, 1);
|
return ZSTD_DUBT_findBestMatch(zc, ip, iLimit, offsetPtr, maxNbAttempts, mls, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user