Small simplifications in matchfinder

This commit is contained in:
Emmanuel Marty 2023-01-30 13:19:03 +01:00 committed by GitHub
parent 21a0dc70c8
commit 398885a52d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -259,7 +259,7 @@ static int lzsa_find_matches_at(lzsa_compressor *pCompressor, const int nOffset,
if ((matchptr - pMatches) < nMaxMatches) { if ((matchptr - pMatches) < nMaxMatches) {
const unsigned int nMatchOffset = (const unsigned int)(nOffset - match_pos); const unsigned int nMatchOffset = (const unsigned int)(nOffset - match_pos);
if (nMatchOffset <= MAX_OFFSET && nMatchOffset != nPrevOffset) { if (nMatchOffset <= MAX_OFFSET) {
matchptr->length = ((const unsigned short)(ref >> (LCP_SHIFT + TAG_BITS))) | 0x8000; matchptr->length = ((const unsigned short)(ref >> (LCP_SHIFT + TAG_BITS))) | 0x8000;
matchptr->offset = (const unsigned short)nMatchOffset; matchptr->offset = (const unsigned short)nMatchOffset;
matchptr++; matchptr++;
@ -287,6 +287,8 @@ static int lzsa_find_matches_at(lzsa_compressor *pCompressor, const int nOffset,
} }
matchptr->offset = (const unsigned short)nMatchOffset; matchptr->offset = (const unsigned short)nMatchOffset;
matchptr++; matchptr++;
nPrevOffset = nMatchOffset;
} }
} }
@ -299,7 +301,7 @@ static int lzsa_find_matches_at(lzsa_compressor *pCompressor, const int nOffset,
if ((matchptr - pMatches) < nMaxMatches) { if ((matchptr - pMatches) < nMaxMatches) {
const unsigned int nMatchOffset = (const unsigned int)(nOffset - match_pos); const unsigned int nMatchOffset = (const unsigned int)(nOffset - match_pos);
if (nMatchOffset <= MAX_OFFSET && nMatchOffset != nPrevOffset) { if (nMatchOffset <= MAX_OFFSET) {
const unsigned short nMatchLen = ((const unsigned short)(ref >> (LCP_SHIFT + TAG_BITS))); const unsigned short nMatchLen = ((const unsigned short)(ref >> (LCP_SHIFT + TAG_BITS)));
if (nMatchLen > 2) { if (nMatchLen > 2) {