]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Nit: Only Store 2 Hash Variables
authorW. Felix Handte <w@felixhandte.com>
Wed, 18 Aug 2021 20:15:53 +0000 (16:15 -0400)
committerW. Felix Handte <w@felixhandte.com>
Wed, 1 Sep 2021 18:15:04 +0000 (14:15 -0400)
lib/compress/zstd_fast.c

index f731b957d1256331dae9be52c497d4010701bf63..c43c8a6af1e006d443fd6c9a0a2d64f2dbecebd1 100644 (file)
@@ -255,7 +255,6 @@ ZSTD_compressBlock_fast_generic_pipelined(
 
     size_t hash0; /* hash for ip0 */
     size_t hash1; /* hash for ip1 */
-    size_t hash2; /* hash for ip2 */
     U32 idx; /* match idx for ip0 */
     U32 mval; /* src value at match idx */
 
@@ -327,11 +326,13 @@ _start: /* Requires: ip0 */
             goto _offset;
         }
 
+        hash0 = hash1;
+
         /* hash ip[2] */
-        hash2 = ZSTD_hashPtr(ip2, hlog, mls);
+        hash1 = ZSTD_hashPtr(ip2, hlog, mls);
 
         /* lookup ip[1] */
-        idx = hashTable[hash1];
+        idx = hashTable[hash0];
 
         /* advance to next positions */
         {
@@ -341,9 +342,6 @@ _start: /* Requires: ip0 */
                 nextStep += kStepIncr;
             }
 
-            hash0 = hash1;
-            hash1 = hash2;
-
             ip0 = ip1;
             ip1 = ip2;
             ip2 = ip2 + step;