factored the logic selecting lowest match index

as suggested by @terrelln
This commit is contained in:
Yann Collet
2019-08-05 15:18:43 +02:00
parent 0b0b83e8f3
commit facbe8b2c2
5 changed files with 19 additions and 21 deletions
+1 -5
View File
@@ -242,11 +242,7 @@ 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 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 windowLow = ZSTD_getLowestMatchIndex(ms, current, cParams->windowLog);
U32* const bt = ms->chainTable;
U32 const btLog = cParams->chainLog - 1;