summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-11-02 23:25:10 (GMT)
committerYann Collet <cyan@fb.com>2017-11-02 23:25:10 (GMT)
commite06cb03c11ee8821a10fd8496f029c64192c9bc8 (patch)
treec9687064ff3329d14273c3f2f4bd2ebd679eed56 /lib
parent4b8188580084112f01f0d0913ac022162fd71f25 (diff)
downloadlz4-e06cb03c11ee8821a10fd8496f029c64192c9bc8.zip
lz4-e06cb03c11ee8821a10fd8496f029c64192c9bc8.tar.gz
lz4-e06cb03c11ee8821a10fd8496f029c64192c9bc8.tar.bz2
small adaptations for intermediate level 11
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4hc.c2
-rw-r--r--lib/lz4opt.h11
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 44e0b0a..941cda0 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -644,7 +644,7 @@ static int LZ4HC_getSearchNum(int compressionLevel)
{
switch (compressionLevel) {
default: return 0; /* unused */
- case 11: return 128;
+ case 11: return 256;
case 12: return 1<<13;
}
}
diff --git a/lib/lz4opt.h b/lib/lz4opt.h
index 37cc73a..c9fab04 100644
--- a/lib/lz4opt.h
+++ b/lib/lz4opt.h
@@ -301,8 +301,8 @@ static int LZ4HC_compress_optimal (
mlen, cost, mlen);
} } }
last_match_pos = matches[nb_matches_initial-1].len;
- opt[last_match_pos-2].toSearch = 1;
- opt[last_match_pos-1].toSearch = 1;
+ if (fullUpdate) opt[last_match_pos-2].toSearch = 1; /* 1 byte on calgary */
+ if (fullUpdate) opt[last_match_pos-1].toSearch = 1; /* 1 byte on calgary */
opt[last_match_pos].toSearch = 1;
{ int addLit;
for (addLit = 1; addLit <= 3; addLit ++) {
@@ -349,7 +349,6 @@ static int LZ4HC_compress_optimal (
opt[pos].off = 0;
opt[pos].litlen = baseLitlen+litlen;
opt[pos].price = price;
- opt[pos].toSearch = 1;
DEBUGLOG(7, "rPos:%3i => price:%3i (litlen=%i)",
pos, price, opt[pos].litlen);
} } }
@@ -392,8 +391,8 @@ static int LZ4HC_compress_optimal (
opt[pos].toSearch = (((ml-18) % 255) == 0);
} } } }
/* complete following positions with literals */
- opt[last_match_pos-2].toSearch = 1;
- opt[last_match_pos-1].toSearch = 1;
+ if (fullUpdate) opt[last_match_pos-2].toSearch = 1; /* 2 bytes on enwik7 */
+ if (fullUpdate) opt[last_match_pos-1].toSearch = 1; /* 53 bytes on enwik7, 13 bytes on calgary */
opt[last_match_pos].toSearch = 1;
{ int addLit;
for (addLit = 1; addLit <= 3; addLit ++) {
@@ -439,7 +438,7 @@ encode: /* cur, last_match_pos, best_mlen, best_off must be set */
if (ml == 1) { ip++; rPos++; continue; } /* literal; note: can end up with several literals, in which case, skip them */
rPos += ml;
assert(ml >= MINMATCH);
- assert((offset >= 1) && (offset <=65535));
+ assert((offset >= 1) && (offset <= MAX_DISTANCE));
if ( LZ4HC_encodeSequence(&ip, &op, &anchor, ml, ip - offset, limit, oend) ) /* updates ip, op and anchor */
return 0; /* error */
} }