re-inserted last byte test in widerMatch
This commit is contained in:
parent
bdca63ed69
commit
97c18f5f0e
41
lib/lz4hc.c
41
lib/lz4hc.c
@ -181,6 +181,7 @@ LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch (
|
|||||||
const BYTE* const lowPrefixPtr = base + dictLimit;
|
const BYTE* const lowPrefixPtr = base + dictLimit;
|
||||||
const U32 lowLimit = (hc4->lowLimit + 64 KB > (U32)(ip-base)) ? hc4->lowLimit : (U32)(ip - base) - MAX_DISTANCE;
|
const U32 lowLimit = (hc4->lowLimit + 64 KB > (U32)(ip-base)) ? hc4->lowLimit : (U32)(ip - base) - MAX_DISTANCE;
|
||||||
const BYTE* const dictBase = hc4->dictBase;
|
const BYTE* const dictBase = hc4->dictBase;
|
||||||
|
int const delta = (int)(ip-iLowLimit);
|
||||||
int nbAttempts = maxNbAttempts;
|
int nbAttempts = maxNbAttempts;
|
||||||
reg_t const pattern = LZ4_read_ARCH(ip);
|
reg_t const pattern = LZ4_read_ARCH(ip);
|
||||||
U32 matchIndex;
|
U32 matchIndex;
|
||||||
@ -196,26 +197,28 @@ LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch (
|
|||||||
nbAttempts--;
|
nbAttempts--;
|
||||||
if (matchIndex >= dictLimit) {
|
if (matchIndex >= dictLimit) {
|
||||||
const BYTE* const matchPtr = base + matchIndex;
|
const BYTE* const matchPtr = base + matchIndex;
|
||||||
if (LZ4_read32(matchPtr) == (U32)pattern) {
|
if (*(iLowLimit + longest) == *(matchPtr - delta + longest)) {
|
||||||
int mlt = MINMATCH + LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
|
if (LZ4_read32(matchPtr) == (U32)pattern) {
|
||||||
#if 0
|
int mlt = MINMATCH + LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
|
||||||
/* more generic but unfortunately slower ... */
|
#if 0
|
||||||
int const back = LZ4HC_countBack(ip, matchPtr, iLowLimit, lowPrefixPtr);
|
/* more generic but unfortunately slower ... */
|
||||||
#else
|
int const back = LZ4HC_countBack(ip, matchPtr, iLowLimit, lowPrefixPtr);
|
||||||
int back = 0;
|
#else
|
||||||
while ( (ip+back > iLowLimit)
|
int back = 0;
|
||||||
&& (matchPtr+back > lowPrefixPtr)
|
while ( (ip+back > iLowLimit)
|
||||||
&& (ip[back-1] == matchPtr[back-1])) {
|
&& (matchPtr+back > lowPrefixPtr)
|
||||||
back--;
|
&& (ip[back-1] == matchPtr[back-1])) {
|
||||||
}
|
back--;
|
||||||
#endif
|
}
|
||||||
mlt -= back;
|
#endif
|
||||||
|
mlt -= back;
|
||||||
|
|
||||||
if (mlt > longest) {
|
if (mlt > longest) {
|
||||||
longest = mlt;
|
longest = mlt;
|
||||||
*matchpos = matchPtr+back;
|
*matchpos = matchPtr+back;
|
||||||
*startpos = ip+back;
|
*startpos = ip+back;
|
||||||
} }
|
} }
|
||||||
|
}
|
||||||
} else { /* matchIndex < dictLimit */
|
} else { /* matchIndex < dictLimit */
|
||||||
const BYTE* const matchPtr = dictBase + matchIndex;
|
const BYTE* const matchPtr = dictBase + matchIndex;
|
||||||
if (LZ4_read32(matchPtr) == (U32)pattern) {
|
if (LZ4_read32(matchPtr) == (U32)pattern) {
|
||||||
|
Loading…
Reference in New Issue
Block a user