From 613f3ef0d7a776fe4bff381aad445293a3210956 Mon Sep 17 00:00:00 2001 From: Emmanuel Marty Date: Thu, 28 Apr 2022 08:02:27 +0200 Subject: [PATCH] Small cleanup --- src/shrink_block_v2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shrink_block_v2.c b/src/shrink_block_v2.c index 8fc840b..a0a1020 100644 --- a/src/shrink_block_v2.c +++ b/src/shrink_block_v2.c @@ -431,7 +431,7 @@ static void lzsa_optimize_forward_v2(lzsa_compressor *pCompressor, const unsigne const int nRepOffset = cur_arrival[j].rep_offset; if (i >= nRepOffset) { - if (!memcmp(pInWindow + i, pInWindow + i - nRepOffset, MIN_MATCH_SIZE_V2)) { + if (!memcmp(pInWindowStart, pInWindowStart - nRepOffset, MIN_MATCH_SIZE_V2)) { if (nRepOffset) { const unsigned char* pInWindowAtPos; @@ -917,8 +917,8 @@ static int lzsa_optimize_command_count_v2(lzsa_compressor *pCompressor, const un } nPrevRepMatchOffset = nRepMatchOffset; - nRepMatchOffset = pMatch->offset; nRepMatchLen = pMatch->length; + nRepMatchOffset = pMatch->offset; nRepIndex = i; i += pMatch->length; @@ -958,8 +958,8 @@ static int lzsa_write_block_v2(lzsa_compressor *pCompressor, const lzsa_match *p const lzsa_match *pMatch = pBestMatch + i; if (pMatch->length >= MIN_MATCH_SIZE_V2) { - const int nMatchOffset = pMatch->offset; const int nMatchLen = pMatch->length; + const int nMatchOffset = pMatch->offset; const int nEncodedMatchLen = nMatchLen - MIN_MATCH_SIZE_V2; const int nTokenLiteralsLen = (nNumLiterals >= LITERALS_RUN_LEN_V2) ? LITERALS_RUN_LEN_V2 : nNumLiterals; const int nTokenMatchLen = (nEncodedMatchLen >= MATCH_RUN_LEN_V2) ? MATCH_RUN_LEN_V2 : nEncodedMatchLen;