aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2014-07-25 22:30:38 +0300
committerLasse Collin <lasse.collin@tukaani.org>2014-07-25 22:30:38 +0300
commitf48fce093b07aeda95c18850f5e086d9f2383380 (patch)
tree671aef15c2e3b6074f6ec9295a76f0e0b47b3398 /src
parentliblzma: Use lzma_memcmplen() in fast mode of LZMA. (diff)
downloadxz-f48fce093b07aeda95c18850f5e086d9f2383380.tar.xz
liblzma: Simplify LZMA fast mode code by using memcmp().
Diffstat (limited to 'src')
-rw-r--r--src/liblzma/lzma/lzma_encoder_optimum_fast.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/liblzma/lzma/lzma_encoder_optimum_fast.c b/src/liblzma/lzma/lzma_encoder_optimum_fast.c
index 7ecb4cc6..8922cbd9 100644
--- a/src/liblzma/lzma/lzma_encoder_optimum_fast.c
+++ b/src/liblzma/lzma/lzma_encoder_optimum_fast.c
@@ -155,16 +155,7 @@ lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf,
const uint32_t limit = len_main - 1;
for (uint32_t i = 0; i < REPS; ++i) {
- const uint8_t *const buf_back = buf - coder->reps[i] - 1;
-
- if (not_equal_16(buf, buf_back))
- continue;
-
- uint32_t len;
- for (len = 2; len < limit
- && buf[len] == buf_back[len]; ++len) ;
-
- if (len >= limit) {
+ if (memcmp(buf, buf - coder->reps[i] - 1, limit) == 0) {
*back_res = UINT32_MAX;
*len_res = 1;
return;