diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-12-27 19:32:20 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-12-27 19:32:20 +0200 |
commit | 050eb14d29e2537c014662e83599fd8a77f13c45 (patch) | |
tree | 9b5cb2a9d5d7c379901df59b7273b4c98a54fbd6 /src | |
parent | Some xz command line tool improvements. (diff) | |
download | xz-050eb14d29e2537c014662e83599fd8a77f13c45.tar.xz |
Revert a change made in 3b34851de1eaf358cf9268922fa0eeed8278d680
that was related to LZMA_MODE_FAST. The original code is slightly
faster although it compresses slightly worse. But since it is fast
mode, it is better to select the faster version.
Diffstat (limited to 'src')
-rw-r--r-- | src/liblzma/lzma/lzma_encoder_optimum_fast.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/liblzma/lzma/lzma_encoder_optimum_fast.c b/src/liblzma/lzma/lzma_encoder_optimum_fast.c index 4e8e26a2..a13adbe4 100644 --- a/src/liblzma/lzma/lzma_encoder_optimum_fast.c +++ b/src/liblzma/lzma/lzma_encoder_optimum_fast.c @@ -23,17 +23,6 @@ (((big_dist) >> 7) > (small_dist)) -static inline void -literal(const lzma_coder *restrict coder, const uint8_t *restrict buf, - uint32_t *restrict back_res, uint32_t *restrict len_res) -{ - // Try short rep0 instead of always coding it as a literal. - *back_res = *buf == *(buf - coder->reps[0] - 1) ? 0 : UINT32_MAX; - *len_res = 1; - return; -} - - extern void lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, uint32_t *restrict back_res, uint32_t *restrict len_res) @@ -55,7 +44,8 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, if (buf_avail < 2) { // There's not enough input left to encode a match. - literal(coder, buf, back_res, len_res); + *back_res = UINT32_MAX; + *len_res = 1; return; } @@ -137,7 +127,8 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, } if (len_main < 2 || buf_avail <= 2) { - literal(coder, buf, back_res, len_res); + *back_res = UINT32_MAX; + *len_res = 1; return; } @@ -158,7 +149,8 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, || (coder->longest_match_length + 1 >= len_main && len_main >= 3 && change_pair(new_dist, back_main))) { - literal(coder, buf, back_res, len_res); + *back_res = UINT32_MAX; + *len_res = 1; return; } } @@ -181,7 +173,8 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf, && buf[len] == buf_back[len]; ++len) ; if (len >= limit) { - literal(coder, buf - 1, back_res, len_res); + *back_res = UINT32_MAX; + *len_res = 1; return; } } |