From: inikep Date: Tue, 8 Mar 2016 10:03:55 +0000 (+0100) Subject: fixed update of hashTable for matches with length of 4+ X-Git-Tag: v0.6.0^2~17^2~78^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F141%2Fhead;p=thirdparty%2Fzstd.git fixed update of hashTable for matches with length of 4+ --- diff --git a/lib/zstd_opt.h b/lib/zstd_opt.h index 68a3c315a..961964bd2 100644 --- a/lib/zstd_opt.h +++ b/lib/zstd_opt.h @@ -227,7 +227,6 @@ static U32 ZSTD_insertBtAndGetAllMatches ( const U32 minMatch = (mls == 3) ? 3 : 4; size_t bestLength = minMatch-1; - hashTable[h] = current; /* Update Hash Table */ if (minMatch == 3) { /* HC3 match finder */ U32 matchIndex3 = ZSTD_insertAndFindFirstIndexHash3 (zc, ip); @@ -256,6 +255,8 @@ static U32 ZSTD_insertBtAndGetAllMatches ( } } + hashTable[h] = current; /* Update Hash Table */ + while (nbCompares-- && (matchIndex > windowLow)) { U32* nextPtr = bt + 2*(matchIndex & btMask); size_t matchLength = MIN(commonLengthSmaller, commonLengthLarger); /* guaranteed minimum nb of common bytes */