slightly improved decompression speed (~+1-2%)

by making shortcut slightly more common
This commit is contained in:
Yann Collet 2018-02-11 01:42:12 -08:00
parent f76ee4e267
commit 3ad3b0f850

View File

@ -1220,10 +1220,13 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
size_t const ll = token >> ML_BITS;
size_t const off = LZ4_readLE16(ip+ll);
const BYTE* const matchPtr = op + ll - off; /* pointer underflow risk ? */
if ((off >= 18) /* do not deal with overlapping matches */ & (matchPtr >= lowPrefix)) {
if ((off >= 8) /* do not deal with overlapping matches */ & (matchPtr >= lowPrefix)) {
size_t const ml = (token & ML_MASK) + MINMATCH;
memcpy(op, ip, 16); op += ll; ip += ll + 2 /*offset*/;
memcpy(op, matchPtr, 18); op += ml;
memcpy(op+ 0, matchPtr+ 0, 8);
memcpy(op+ 8, matchPtr+ 8, 8);
memcpy(op+16, matchPtr+16, 2);
op += ml;
continue;
}
}