]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[cover] Stop when segmentSize is less than d
authorNick Terrell <terrelln@fb.com>
Mon, 21 Aug 2017 20:10:03 +0000 (13:10 -0700)
committerNick Terrell <terrelln@fb.com>
Mon, 21 Aug 2017 20:10:03 +0000 (13:10 -0700)
lib/dictBuilder/cover.c

index 3d445ae8b81d1bfce64c19ba08d45e201cadcba8..501b5b490ad530137f49c249c2ac4b504ad27f47 100644 (file)
@@ -622,9 +622,9 @@ static size_t COVER_buildDictionary(const COVER_ctx_t *ctx, U32 *freqs,
     /* Select a segment */
     COVER_segment_t segment = COVER_selectSegment(
         ctx, freqs, activeDmers, epochBegin, epochEnd, parameters);
-    /* Trim the segment if necessary and if it is empty then we are done */
+    /* Trim the segment if necessary and if it is too small then we are done */
     segmentSize = MIN(segment.end - segment.begin + parameters.d - 1, tail);
-    if (segmentSize == 0) {
+    if (segmentSize < parameters.d) {
       break;
     }
     /* We fill the dictionary from the back to allow the best segments to be