]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
rewrite penalty update
authorYann Collet <cyan@fb.com>
Tue, 22 Oct 2024 23:06:07 +0000 (16:06 -0700)
committerYann Collet <cyan@fb.com>
Wed, 23 Oct 2024 18:50:57 +0000 (11:50 -0700)
suggested by @terrelln

lib/compress/zstd_preSplit.c

index 02751a0d473a332f3ce60c97ebee639b58ece002..2e65f88d921fd3eafaba6aa8b4608d16dbc4f023 100644 (file)
@@ -161,7 +161,7 @@ static size_t ZSTD_splitBlock_byChunks(const void* src, size_t srcSize,
             return pos;
         } else {
             mergeEvents(&fpstats->pastEvents, &fpstats->newEvents);
-            penalty = penalty - 1 + (penalty == 0);
+            if (penalty > 0) penalty--;
         }
     }
     assert(pos == blockSizeMax);