Only load extra table positions for CDicts

Zstdmt uses prefixes to load the overlap between segments. Loading extra
positions makes compression non-deterministic, depending on the previous
job the context was used for. Since loading extra position takes extra
time as well, only do it when creating a `ZSTD_CDict`.

Fixes #1077.
This commit is contained in:
Nick Terrell
2018-04-02 14:41:30 -07:00
parent daf3ab0aad
commit 295ab0dbfa
8 changed files with 44 additions and 24 deletions
+4 -1
View File
@@ -14,7 +14,7 @@
void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
ZSTD_compressionParameters const* cParams,
void const* end)
void const* end, ZSTD_dictTableLoadMethod_e dtlm)
{
U32* const hashLarge = ms->hashTable;
U32 const hBitsL = cParams->hashLog;
@@ -40,6 +40,9 @@ void ZSTD_fillDoubleHashTable(ZSTD_matchState_t* ms,
hashSmall[smHash] = current + i;
if (i == 0 || hashLarge[lgHash] == 0)
hashLarge[lgHash] = current + i;
/* Only load extra positions for ZSTD_dtlm_full */
if (dtlm == ZSTD_dtlm_fast)
break;
}
}
}