From: W. Felix Handte Date: Fri, 14 Sep 2018 22:23:35 +0000 (-0700) Subject: ZSTD_fast: Don't Search Dict Context When Mismatch Was Found X-Git-Tag: v0.0.29~5^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b048af5999061a41e68d1083ef7b0ab2fe75e29d;p=thirdparty%2Fzstd.git ZSTD_fast: Don't Search Dict Context When Mismatch Was Found --- diff --git a/lib/compress/zstd_fast.c b/lib/compress/zstd_fast.c index 37a715167..7d7efb465 100644 --- a/lib/compress/zstd_fast.c +++ b/lib/compress/zstd_fast.c @@ -124,8 +124,7 @@ size_t ZSTD_compressBlock_fast_generic( mLength = ZSTD_count(ip+1+4, ip+1+4-offset_1, iend) + 4; ip++; ZSTD_storeSeq(seqStore, ip-anchor, anchor, 0, mLength-MINMATCH); - } else if ( (matchIndex <= prefixStartIndex) - || (MEM_read32(match) != MEM_read32(ip)) ) { + } else if ( (matchIndex <= prefixStartIndex) ) { if (dictMode == ZSTD_dictMatchState) { U32 const dictMatchIndex = dictHashTable[h]; const BYTE* dictMatch = dictBase + dictMatchIndex; @@ -151,6 +150,11 @@ size_t ZSTD_compressBlock_fast_generic( ip += ((ip-anchor) >> kSearchStrength) + stepSize; continue; } + } else if (MEM_read32(match) != MEM_read32(ip)) { + /* it's not a match, and we're not going to check the dictionary */ + assert(stepSize >= 1); + ip += ((ip-anchor) >> kSearchStrength) + stepSize; + continue; } else { /* found a regular match */ U32 const offset = (U32)(ip-match);