summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-10-19 23:39:40 (GMT)
committerYann Collet <cyan@fb.com>2017-10-19 23:39:40 (GMT)
commit708e2cbb60c7c074cbe9277388abc397403ef418 (patch)
tree3af3e86116e67e5dbbf6a9c16a8070de6bc0e48b
parenta4314829db575453911046e2b0d5a19697b14a67 (diff)
downloadlz4-708e2cbb60c7c074cbe9277388abc397403ef418.zip
lz4-708e2cbb60c7c074cbe9277388abc397403ef418.tar.gz
lz4-708e2cbb60c7c074cbe9277388abc397403ef418.tar.bz2
simplified early exit when single solution
-rw-r--r--lib/lz4opt.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/lz4opt.h b/lib/lz4opt.h
index 584dc97..1f8f580 100644
--- a/lib/lz4opt.h
+++ b/lib/lz4opt.h
@@ -245,11 +245,11 @@ static int LZ4HC_compress_optimal (
if ((size_t)matches[match_num-1].len > sufficient_len) {
/* good enough solution : immediate encoding */
- best_mlen = matches[match_num-1].len;
- best_off = matches[match_num-1].off;
- cur = 0;
- last_pos = 1;
- goto encode;
+ int const firstML = (int)matches[match_num-1].len;
+ const BYTE* const matchPos = ip - matches[match_num-1].off;
+ if ( LZ4HC_encodeSequence(&ip, &op, &anchor, (int)firstML, matchPos, limit, oend) ) /* updates ip, op and anchor */
+ return 0; /* error */
+ continue;
}
/* set prices using matches at position = 0 */