mirror of
https://github.com/facebook/zstd.git
synced 2025-09-05 14:04:09 +03:00
simplify sequence resolution in zstd_opt
initially hinted by @pitaj in #4442
This commit is contained in:
@@ -1382,16 +1382,8 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */
|
|||||||
assert(storeEnd < ZSTD_OPT_SIZE);
|
assert(storeEnd < ZSTD_OPT_SIZE);
|
||||||
DEBUGLOG(6, "last stretch copied into pos=%u (llen=%u,mlen=%u,ofc=%u)",
|
DEBUGLOG(6, "last stretch copied into pos=%u (llen=%u,mlen=%u,ofc=%u)",
|
||||||
storeEnd, lastStretch.litlen, lastStretch.mlen, lastStretch.off);
|
storeEnd, lastStretch.litlen, lastStretch.mlen, lastStretch.off);
|
||||||
if (lastStretch.litlen > 0) {
|
opt[storeEnd] = lastStretch; /* note: litlen will be fixed */
|
||||||
/* last "sequence" is unfinished: just a bunch of literals */
|
storeStart = storeEnd;
|
||||||
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;
|
|
||||||
}
|
|
||||||
while (1) {
|
while (1) {
|
||||||
ZSTD_optimal_t nextStretch = opt[stretchPos];
|
ZSTD_optimal_t nextStretch = opt[stretchPos];
|
||||||
opt[storeStart].litlen = nextStretch.litlen;
|
opt[storeStart].litlen = nextStretch.litlen;
|
||||||
|
Reference in New Issue
Block a user