summaryrefslogtreecommitdiffstats
path: root/lib/lz4opt.h
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-10-25 05:07:08 (GMT)
committerYann Collet <cyan@fb.com>2017-10-25 05:07:08 (GMT)
commit16a433747309d209c2247c5074ff3ac8783548c7 (patch)
treec9991f5e73720662f008f93f758c4c7ff39ea6ce /lib/lz4opt.h
parenta12cdf00c3d0a0e3e7b2638d4a256f14b15c0072 (diff)
downloadlz4-16a433747309d209c2247c5074ff3ac8783548c7.zip
lz4-16a433747309d209c2247c5074ff3ac8783548c7.tar.gz
lz4-16a433747309d209c2247c5074ff3ac8783548c7.tar.bz2
added hash chain with conditional length
not a success yet
Diffstat (limited to 'lib/lz4opt.h')
-rw-r--r--lib/lz4opt.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/lz4opt.h b/lib/lz4opt.h
index ef7b725..bd956ee 100644
--- a/lib/lz4opt.h
+++ b/lib/lz4opt.h
@@ -213,7 +213,7 @@ LZ4_FORCE_INLINE int LZ4HC_HashChain_GetAllMatches (
{
const BYTE* matchPtr;
int matchLength = LZ4HC_FindLongerMatch(ctx, ip, iHighLimit, (int)best_mlen, &matchPtr, ctx->searchNum);
- if (matchLength < MINMATCH) return 0;
+ if ((size_t)matchLength <= best_mlen) return 0;
assert(matches != NULL);
matches[0].len = matchLength;
matches[0].off = (int)(ip-matchPtr);
@@ -327,6 +327,7 @@ static int LZ4HC_compress_optimal (
//nb_matches = LZ4HC_BinTree_GetAllMatches(ctx, curPtr, matchlimit, MINMATCH-1, matches, fullUpdate);
nb_matches = LZ4HC_HashChain_GetAllMatches(ctx, curPtr, matchlimit, MINMATCH-1, matches, fullUpdate);
+ //nb_matches = LZ4HC_HashChain_GetAllMatches(ctx, curPtr, matchlimit, last_match_pos - cur + 1, matches, fullUpdate); /* only works if last_match_pos is really the last match pos */
if ((nb_matches > 0) && (size_t)matches[nb_matches-1].len > sufficient_len) {
/* immediate encoding */
best_mlen = matches[nb_matches-1].len;