From 8bfa42e61e65152fbe6f62eedb3c15ad7b034260 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Wed, 7 Dec 2016 15:49:45 +0100 Subject: improved ratio --- lib/lz4hc.h | 2 +- lib/lz4opt.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/lz4hc.h b/lib/lz4hc.h index 0523314..5eafcd6 100644 --- a/lib/lz4hc.h +++ b/lib/lz4hc.h @@ -131,7 +131,7 @@ LZ4LIB_API int LZ4_saveDictHC (LZ4_streamHC_t* streamHCPtr, char* safeBuffer, in * Using these definitions makes the code vulnerable to potential API break when upgrading LZ4 **************************************/ #define LZ4HC_DICTIONARY_LOGSIZE 16 -#define LZ4HC_MAXD (1<<(LZ4HC_DICTIONARY_LOGSIZE+1)) +#define LZ4HC_MAXD (1<<(LZ4HC_DICTIONARY_LOGSIZE)) #define LZ4HC_MAXD_MASK (LZ4HC_MAXD - 1) #define LZ4HC_HASH_LOG (LZ4HC_DICTIONARY_LOGSIZE-1) diff --git a/lib/lz4opt.h b/lib/lz4opt.h index a2a9d0b..1ff3375 100644 --- a/lib/lz4opt.h +++ b/lib/lz4opt.h @@ -224,7 +224,7 @@ static int LZ4HC_compress_optimal ( while (mlen <= best_mlen) { litlen = 0; price = LZ4HC_get_price(llen + litlen, mlen) - 8*llen; - if (mlen > last_pos || price < (size_t)opt[mlen].price) + if (mlen > last_pos || price <= (size_t)opt[mlen].price) SET_PRICE(mlen, mlen, matches[i].off, litlen, price); mlen++; } @@ -255,7 +255,7 @@ static int LZ4HC_compress_optimal ( mlen = 1; best_mlen = 0; LZ4_LOG_PARSER("%d: TRY price=%d opt[%d].price=%d\n", (int)(inr-source), price, cur, opt[cur].price); - if (cur > last_pos || price <= (size_t)opt[cur].price) // || ((price == opt[cur].price) && (opt[cur-1].mlen == 1) && (cur != litlen))) + if (cur > last_pos || price < (size_t)opt[cur].price) // || ((price == opt[cur].price) && (opt[cur-1].mlen == 1) && (cur != litlen))) SET_PRICE(cur, mlen, best_mlen, litlen, price); if (cur == last_pos) break; -- cgit v0.12