Only Perform Dict Lookup if Attempts Remain

This commit is contained in:
W. Felix Handte 2018-03-26 11:43:52 -04:00
parent b6c35ed642
commit b88a0b4e88

View File

@ -288,7 +288,7 @@ LZ4HC_InsertAndGetWiderMatch (
} } } }
} /* while ((matchIndex>=lowLimit) && (matchIndex < (ip - base)) && (nbAttempts)) */
if (dictCtx != NULL) {
if (dictCtx != NULL && nbAttempts) {
ptrdiff_t dictIndexDelta = dictCtx->base - dictCtx->end + lowLimit;
dictMatchIndex = dictCtx->hashTable[LZ4HC_hashPtr(ip)];
matchIndex = dictMatchIndex + dictIndexDelta;