summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-03-18 01:07:53 (GMT)
committerYann Collet <cyan@fb.com>2017-03-20 09:33:02 (GMT)
commitcea8f60df14d3c538e0a420eb15b808159ab6c09 (patch)
tree05fe4a0600f13a2b947b0c779ddada93004e8c1f
parent8bd32a17b112dd46f61d835e4368ff1bc4464048 (diff)
downloadlz4-cea8f60df14d3c538e0a420eb15b808159ab6c09.zip
lz4-cea8f60df14d3c538e0a420eb15b808159ab6c09.tar.gz
lz4-cea8f60df14d3c538e0a420eb15b808159ab6c09.tar.bz2
slight btopt speed improvement
removing a useless test
-rw-r--r--lib/lz4opt.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/lz4opt.h b/lib/lz4opt.h
index f12468a..36c84bb 100644
--- a/lib/lz4opt.h
+++ b/lib/lz4opt.h
@@ -278,13 +278,14 @@ static int LZ4HC_compress_optimal (
mlen = 1;
best_mlen = 0;
- if (cur > last_pos || price < (size_t)opt[cur].price)
- SET_PRICE(cur, mlen, best_mlen, litlen, price);
+ if (price < (size_t)opt[cur].price)
+ SET_PRICE(cur, mlen, best_mlen, litlen, price); /* note : increases last_pos */
if (cur == last_pos || inr >= mflimit) break;
match_num = LZ4HC_BinTree_GetAllMatches(ctx, inr, matchlimit, MINMATCH-1, matches, fullUpdate);
- if (match_num > 0 && (size_t)matches[match_num-1].len > sufficient_len) {
+ if ((match_num > 0) && (size_t)matches[match_num-1].len > sufficient_len) {
+ /* immediate encoding */
best_mlen = matches[match_num-1].len;
best_off = matches[match_num-1].off;
last_pos = cur + 1;