]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
always attach dict when using dedicatedDictSearch
authorBimba Shrestha <bimbashrestha@fb.com>
Thu, 11 Jun 2020 21:19:12 +0000 (14:19 -0700)
committerW. Felix Handte <w@felixhandte.com>
Thu, 10 Sep 2020 22:51:52 +0000 (18:51 -0400)
lib/compress/zstd_compress.c

index b7d7bcd02d49b7e82c45f204a7e6e3100c7df9d3..3671a6621bfc32b5c2d523ce21ed3d96e11c722d 100644 (file)
@@ -1640,7 +1640,11 @@ static int ZSTD_shouldAttachDict(const ZSTD_CDict* cdict,
                                  U64 pledgedSrcSize)
 {
     size_t cutoff = attachDictSizeCutoffs[cdict->matchState.cParams.strategy];
-    return ( pledgedSrcSize <= cutoff
+    int const useDedicatedDictSearch =
+        params->enableDedicatedDictSearch &&
+        ZSTD_dedicatedDictSearch_isSupported(params->compressionLevel, cdict->dictContentSize);
+    return ( useDedicatedDictSearch
+          || pledgedSrcSize <= cutoff
           || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN
           || params->attachDictPref == ZSTD_dictForceAttach )
         && params->attachDictPref != ZSTD_dictForceCopy