Skip to content

Commit

Permalink
dynamic multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellerozenblit committed Mar 13, 2023
1 parent 300a59d commit 7cba253
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/compress/zstd_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -4687,7 +4687,9 @@ static size_t ZSTD_loadDictionaryContent(ZSTD_matchState_t* ms,
}

/* If the dict is larger than we can reasonably index in our tables, only load the suffix. */
{ U32 maxDictSize = 8U * (1U << MIN(MAX(params->cParams.hashLog, params->cParams.chainLog), 28));
{
U32 multiplierLog = params->cParams.strategy >= ZSTD_btultra ? 8 : 3; /* multiplier based on strategy */
U32 maxDictSize = 1U << MIN(MAX(params->cParams.hashLog, params->cParams.chainLog) + multiplierLog, 31);
if (srcSize > maxDictSize) {
ip = iend - maxDictSize;
src = ip;
Expand Down

0 comments on commit 7cba253

Please sign in to comment.