mirror of
https://github.com/facebook/zstd.git
synced 2025-10-08 00:04:02 -04:00
complementary code comments
on variables used / impacted during maxDist check
This commit is contained in:
parent
4baecdf72a
commit
6453f8158f
@ -2866,10 +2866,13 @@ static size_t ZSTD_compress_frameChunk (ZSTD_CCtx* cctx,
|
|||||||
ZSTD_reduceIndex(cctx, correction);
|
ZSTD_reduceIndex(cctx, correction);
|
||||||
if (ms->nextToUpdate < correction) ms->nextToUpdate = 0;
|
if (ms->nextToUpdate < correction) ms->nextToUpdate = 0;
|
||||||
else ms->nextToUpdate -= correction;
|
else ms->nextToUpdate -= correction;
|
||||||
|
/* invalidate dictionaries on overflow correction */
|
||||||
ms->loadedDictEnd = 0;
|
ms->loadedDictEnd = 0;
|
||||||
ms->dictMatchState = NULL;
|
ms->dictMatchState = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZSTD_window_enforceMaxDist(&ms->window, ip + blockSize, maxDist, &ms->loadedDictEnd, &ms->dictMatchState);
|
ZSTD_window_enforceMaxDist(&ms->window, ip + blockSize, maxDist, &ms->loadedDictEnd, &ms->dictMatchState);
|
||||||
|
/* Ensure hash/chain table insertion resumes no sooner than lowlimit */
|
||||||
if (ms->nextToUpdate < ms->window.lowLimit) ms->nextToUpdate = ms->window.lowLimit;
|
if (ms->nextToUpdate < ms->window.lowLimit) ms->nextToUpdate = ms->window.lowLimit;
|
||||||
|
|
||||||
{ size_t cSize = ZSTD_compressBlock_internal(cctx,
|
{ size_t cSize = ZSTD_compressBlock_internal(cctx,
|
||||||
|
@ -134,9 +134,9 @@ typedef struct {
|
|||||||
typedef struct ZSTD_matchState_t ZSTD_matchState_t;
|
typedef struct ZSTD_matchState_t ZSTD_matchState_t;
|
||||||
struct ZSTD_matchState_t {
|
struct ZSTD_matchState_t {
|
||||||
ZSTD_window_t window; /* State for window round buffer management */
|
ZSTD_window_t window; /* State for window round buffer management */
|
||||||
U32 loadedDictEnd; /* index of end of dictionary, within dictionary's referential. Only used for attached dictionaries. Effectively same value as dictSize, since dictionary indexes start a zero */
|
U32 loadedDictEnd; /* index of end of dictionary, within context's referential. When dict referential is copied into active context (i.e. not attached), effectively same value as dictSize, since referential starts at zero */
|
||||||
U32 nextToUpdate; /* index from which to continue table update */
|
U32 nextToUpdate; /* index from which to continue table update */
|
||||||
U32 nextToUpdate3; /* index from which to continue table update */
|
U32 nextToUpdate3; /* index from which to continue table update of hashTable3 */
|
||||||
U32 hashLog3; /* dispatch table : larger == faster, more memory */
|
U32 hashLog3; /* dispatch table : larger == faster, more memory */
|
||||||
U32* hashTable;
|
U32* hashTable;
|
||||||
U32* hashTable3;
|
U32* hashTable3;
|
||||||
|
@ -862,7 +862,7 @@ ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms,
|
|||||||
DEBUGLOG(5, "ZSTD_compressBlock_opt_generic: current=%u, prefix=%u, nextToUpdate=%u",
|
DEBUGLOG(5, "ZSTD_compressBlock_opt_generic: current=%u, prefix=%u, nextToUpdate=%u",
|
||||||
(U32)(ip - base), ms->window.dictLimit, ms->nextToUpdate);
|
(U32)(ip - base), ms->window.dictLimit, ms->nextToUpdate);
|
||||||
assert(optLevel <= 2);
|
assert(optLevel <= 2);
|
||||||
ms->nextToUpdate3 = ms->nextToUpdate;
|
ms->nextToUpdate3 = ms->nextToUpdate; /* note : why a separate nextToUpdate3 stored into cctx->ms if it's synchtonized from nextToUpdate anyway ? */
|
||||||
ZSTD_rescaleFreqs(optStatePtr, (const BYTE*)src, srcSize, optLevel);
|
ZSTD_rescaleFreqs(optStatePtr, (const BYTE*)src, srcSize, optLevel);
|
||||||
ip += (ip==prefixStart);
|
ip += (ip==prefixStart);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user