]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Minor fix for non-rolling hash
authorStella Lau <laus@fb.com>
Wed, 12 Jul 2017 16:50:24 +0000 (09:50 -0700)
committerStella Lau <laus@fb.com>
Wed, 12 Jul 2017 16:50:24 +0000 (09:50 -0700)
contrib/long_distance_matching/ldm.c

index 79648097aac68943d694b4d847ce9f59753bc212..a1fe6174ba7ed11129012acf3ce21ba7cffd5afe 100644 (file)
@@ -518,10 +518,11 @@ static void LDM_outputBlock(LDM_CCtx *cctx, const BYTE *match) {
   while (cctx->ip < cctx->anchor + MINMATCH + matchLength + literalLength) {
 //    printf("Loop\n");
     if (cctx->ip > cctx->lastPosHashed) {
-      LDM_updateLastHashFromNextHash(cctx);
-//      LDM_putHashOfCurrentPosition(cctx);
 #ifdef LDM_ROLLING_HASH
+      LDM_updateLastHashFromNextHash(cctx);
       LDM_setNextHash(cctx);
+#else
+      LDM_putHashOfCurrentPosition(cctx);
 #endif
     }
     /*
@@ -594,9 +595,10 @@ size_t LDM_compress(const void *src, size_t srcSize,
 
     // Set start of next block to current input pointer.
     cctx.anchor = cctx.ip;
+#ifdef LDM_ROLLING_HASH
     LDM_updateLastHashFromNextHash(&cctx);
-//    LDM_putHashOfCurrentPosition(&cctx);
-#ifndef LDM_ROLLING_HASH
+#else
+    LDM_putHashOfCurrentPosition(&cctx);
     cctx.ip++;
 #endif