From: Yann Collet Date: Fri, 2 Aug 2019 12:26:26 +0000 (+0200) Subject: fixed strategy btlazy2 X-Git-Tag: v1.4.3^2~5^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4257b04e7be0dc5f8b55710b876a154bf480498;p=thirdparty%2Fzstd.git fixed strategy btlazy2 --- diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c index c6f45c307..e43c25f96 100644 --- a/lib/compress/zstd_lazy.c +++ b/lib/compress/zstd_lazy.c @@ -243,8 +243,10 @@ ZSTD_DUBT_findBestMatch(ZSTD_matchState_t* ms, const BYTE* const base = ms->window.base; U32 const current = (U32)(ip-base); U32 const maxDistance = 1U << cParams->windowLog; - U32 const windowValid = ms->window.lowLimit; - U32 const windowLow = (current - windowValid > maxDistance) ? current - maxDistance : windowValid; + U32 const lowestValid = ms->window.lowLimit; + U32 const withinWindow = (current - lowestValid > maxDistance) ? current - maxDistance : lowestValid; + U32 const isDictionary = (ms->loadedDictEnd != 0); + U32 const windowLow = isDictionary ? lowestValid : withinWindow; U32* const bt = ms->chainTable; U32 const btLog = cParams->chainLog - 1;