From 0055ce7a02cb39b55ffc6bc468641ecbb65e90a4 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Fri, 18 Jul 2025 21:21:47 -0700 Subject: [PATCH] simplify sequence resolution in zstd_opt initially hinted by @pitaj in #4442 --- lib/compress/zstd_opt.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/compress/zstd_opt.c b/lib/compress/zstd_opt.c index 3d7171b75..562a6b17b 100644 --- a/lib/compress/zstd_opt.c +++ b/lib/compress/zstd_opt.c @@ -1382,16 +1382,8 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */ assert(storeEnd < ZSTD_OPT_SIZE); DEBUGLOG(6, "last stretch copied into pos=%u (llen=%u,mlen=%u,ofc=%u)", storeEnd, lastStretch.litlen, lastStretch.mlen, lastStretch.off); - if (lastStretch.litlen > 0) { - /* last "sequence" is unfinished: just a bunch of literals */ - opt[storeEnd].litlen = lastStretch.litlen; - opt[storeEnd].mlen = 0; - storeStart = storeEnd-1; - opt[storeStart] = lastStretch; - } { - opt[storeEnd] = lastStretch; /* note: litlen will be fixed */ - storeStart = storeEnd; - } + opt[storeEnd] = lastStretch; /* note: litlen will be fixed */ + storeStart = storeEnd; while (1) { ZSTD_optimal_t nextStretch = opt[stretchPos]; opt[storeStart].litlen = nextStretch.litlen; -- 2.47.2