Fix Off-By-One Error in Counting DDS Search Attempts
This caused us to double-search the first position and fail to search the last position in the chain, slowing down search and making it less effective.
This commit is contained in:
@@ -575,7 +575,7 @@ size_t ZSTD_HcFindBestMatch_generic (
|
|||||||
const U32 ddsMinChain = ddsSize > ddsChainSize ? ddsSize - ddsChainSize : 0;
|
const U32 ddsMinChain = ddsSize > ddsChainSize ? ddsSize - ddsChainSize : 0;
|
||||||
const U32 bucketSize = (1 << DD_BLOG);
|
const U32 bucketSize = (1 << DD_BLOG);
|
||||||
|
|
||||||
U32 attemptNb = 0;
|
U32 attemptNb = 1;
|
||||||
|
|
||||||
matchIndex = dms->hashTable[ddsIdx];
|
matchIndex = dms->hashTable[ddsIdx];
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ size_t ZSTD_HcFindBestMatch_generic (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attemptNb < bucketSize - 1) {
|
if (attemptNb < bucketSize) {
|
||||||
matchIndex = dms->hashTable[ddsIdx + attemptNb];
|
matchIndex = dms->hashTable[ddsIdx + attemptNb];
|
||||||
} else {
|
} else {
|
||||||
matchIndex = dms->chainTable[matchIndex & ddsChainMask];
|
matchIndex = dms->chainTable[matchIndex & ddsChainMask];
|
||||||
|
|||||||
Reference in New Issue
Block a user