Prevent duplicate LDMs from being inserted

This commit is contained in:
senhuang42
2020-10-07 13:56:25 -04:00
parent 65f9cfeeec
commit 4793ae3b84
+4
View File
@@ -868,6 +868,10 @@ static void ldm_maybeAddLdm(ZSTD_match_t* matches, U32* nbMatches,
* the ldm match down as necessary.
*/
if (candidateMatchLength == matches[*nbMatches-1].len) {
if (candidateOffCode == matches[*nbMatches-1].off) {
/* No need to insert the match if it's the exact same */
return;
}
U32 candidateMatchIdx = *nbMatches;
matches[*nbMatches].len = candidateMatchLength;
matches[*nbMatches].off = candidateOffCode;