diff options
author | Yann Collet <cyan@fb.com> | 2017-10-09 06:40:21 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-10-09 06:40:21 (GMT) |
commit | f1fa91d6fc74576dcde98b6514cfc8cc57f6f50f (patch) | |
tree | f69b05b01fe5856b9bdb14c2f9dd5e0aedcb055c | |
parent | 87968517f926b55c2af3cf39e9692b368c566103 (diff) | |
download | lz4-f1fa91d6fc74576dcde98b6514cfc8cc57f6f50f.zip lz4-f1fa91d6fc74576dcde98b6514cfc8cc57f6f50f.tar.gz lz4-f1fa91d6fc74576dcde98b6514cfc8cc57f6f50f.tar.bz2 |
insertAndFindBestMatch defers to insertAndGetWiderMatch
-rw-r--r-- | lib/lz4hc.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index d7f8d23..f4a0981 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -116,7 +116,7 @@ LZ4_FORCE_INLINE void LZ4HC_Insert (LZ4HC_CCtx_internal* hc4, const BYTE* ip) hc4->nextToUpdate = target; } - +#if 0 LZ4_FORCE_INLINE int LZ4HC_InsertAndFindBestMatch (LZ4HC_CCtx_internal* const hc4, /* Index table will be updated */ const BYTE* const ip, const BYTE* const iLimit, const BYTE** matchpos, @@ -163,7 +163,7 @@ LZ4_FORCE_INLINE int LZ4HC_InsertAndFindBestMatch (LZ4HC_CCtx_internal* const hc return (int)ml; } - +#endif LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch ( LZ4HC_CCtx_internal* hc4, @@ -234,6 +234,16 @@ LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch ( return longest; } +LZ4_FORCE_INLINE +int LZ4HC_InsertAndFindBestMatch(LZ4HC_CCtx_internal* const hc4, /* Index table will be updated */ + const BYTE* const ip, const BYTE* const iLimit, + const BYTE** matchpos, + const int maxNbAttempts) +{ + const BYTE* uselessPtr = ip; + return LZ4HC_InsertAndGetWiderMatch(hc4, ip, ip, iLimit, MINMATCH-1, matchpos, &uselessPtr, maxNbAttempts); +} + typedef enum { noLimit = 0, @@ -353,7 +363,7 @@ static int LZ4HC_compress_hashChain ( /* Main Loop */ while (ip < mflimit) { ml = LZ4HC_InsertAndFindBestMatch (ctx, ip, matchlimit, (&ref), maxNbAttempts); - if (!ml) { ip++; continue; } + if (ml<MINMATCH) { ip++; continue; } /* saved, in case we would skip too much */ start0 = ip; |