diff options
author | Yann Collet <cyan@fb.com> | 2017-10-20 20:32:45 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-10-20 20:32:45 (GMT) |
commit | fa064c8a8c5f333a90232ecab0ef74b8cbf10476 (patch) | |
tree | f9086c43472e35ea70b6515979486cbc5c39e309 /lib | |
parent | ee62faee085fe04ed657626a2320a5140989746c (diff) | |
download | lz4-fa064c8a8c5f333a90232ecab0ef74b8cbf10476.zip lz4-fa064c8a8c5f333a90232ecab0ef74b8cbf10476.tar.gz lz4-fa064c8a8c5f333a90232ecab0ef74b8cbf10476.tar.bz2 |
removed one macro usage
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lz4opt.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/lz4opt.h b/lib/lz4opt.h index 48862f2..488af90 100644 --- a/lib/lz4opt.h +++ b/lib/lz4opt.h @@ -284,7 +284,8 @@ static int LZ4HC_compress_optimal ( size_t nb_matches; /* establish baseline price if cur is literal */ - { size_t price, litlen; + { size_t price; + int litlen; if (opt[cur-1].mlen == 1) { /* no match at previous position */ litlen = opt[cur-1].litlen + 1; @@ -293,13 +294,19 @@ static int LZ4HC_compress_optimal ( litlen = 1; price = opt[cur - 1].price + LZ4HC_literalsPrice(1); } - - if (price < (size_t)opt[cur].price) - SET_PRICE(cur, 1 /*mlen*/, 0 /*off*/, litlen, price); /* note : increases last_match_pos */ + if (price < (size_t)opt[cur].price) { + opt[cur].mlen = 1; + opt[cur].off = 0; + opt[cur].litlen = litlen; + opt[cur].price = (int)price; + } } if (cur == last_match_pos || curPtr >= mflimit) break; + //assert(cur+2 <= last_match_pos); + //assert(cur+3 <= last_match_pos); + nb_matches = LZ4HC_BinTree_GetAllMatches(ctx, curPtr, matchlimit, MINMATCH-1, matches, fullUpdate); if ((nb_matches > 0) && (size_t)matches[nb_matches-1].len > sufficient_len) { /* immediate encoding */ |