]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed update of hashTable for matches with length of 4+ 141/head
authorinikep <inikep@gmail.com>
Tue, 8 Mar 2016 10:03:55 +0000 (11:03 +0100)
committerinikep <inikep@gmail.com>
Tue, 8 Mar 2016 10:03:55 +0000 (11:03 +0100)
lib/zstd_opt.h

index 68a3c315a970ffcbc08c0bcbf782e1b192cfc4a9..961964bd2168f2224b21cbc2decc66c1b7a677d3 100644 (file)
@@ -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 */