From: inikep Date: Tue, 5 Apr 2016 15:11:56 +0000 (+0200) Subject: ZSTD_REP_NUM=3 only X-Git-Tag: v0.6.0^2~17^2~16^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4385aa23b6c17fa6f38e9a08c90b6fcbaa2cce9;p=thirdparty%2Fzstd.git ZSTD_REP_NUM=3 only --- diff --git a/lib/zstd_compress.c b/lib/zstd_compress.c index 95cd8ff2d..5fcdc6e02 100644 --- a/lib/zstd_compress.c +++ b/lib/zstd_compress.c @@ -1737,18 +1737,12 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx, _storeSequence: { if (offset >= ZSTD_REP_NUM) { -#if ZSTD_REP_NUM > 3 - rep[3] = rep[2]; -#endif rep[2] = rep[1]; rep[1] = rep[0]; rep[0] = offset - ZSTD_REP_MOVE; } else { if (offset != 0) { size_t temp = rep[offset]; -#if ZSTD_REP_NUM > 3 - if (offset > 2) rep[3] = rep[2]; -#endif if (offset > 1) rep[2] = rep[1]; if (offset > 0) rep[1] = rep[0]; rep[0] = temp; diff --git a/lib/zstd_decompress.c b/lib/zstd_decompress.c index 037b6cb2e..64ff6c9a1 100644 --- a/lib/zstd_decompress.c +++ b/lib/zstd_decompress.c @@ -670,9 +670,6 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls) if (offset != 0) { size_t temp = seqState->prevOffset[offset]; if (offset != 1) { -#if ZSTD_REP_NUM > 3 - if (offset == 3) seqState->prevOffset[3] = seqState->prevOffset[2]; -#endif seqState->prevOffset[2] = seqState->prevOffset[1]; } seqState->prevOffset[1] = seqState->prevOffset[0]; @@ -683,9 +680,6 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls) } } else { offset -= ZSTD_REP_MOVE; -#if ZSTD_REP_NUM > 3 - seqState->prevOffset[3] = seqState->prevOffset[2]; -#endif seqState->prevOffset[2] = seqState->prevOffset[1]; seqState->prevOffset[1] = seqState->prevOffset[0]; seqState->prevOffset[0] = offset; diff --git a/lib/zstd_opt.h b/lib/zstd_opt.h index 003823230..4b942d72b 100644 --- a/lib/zstd_opt.h +++ b/lib/zstd_opt.h @@ -551,17 +551,11 @@ void ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx, mlen = opt[cur].mlen; if (opt[cur].off >= ZSTD_REP_NUM) { -#if ZSTD_REP_NUM > 3 - opt[cur].rep[3] = opt[cur-mlen].rep[2]; -#endif opt[cur].rep[2] = opt[cur-mlen].rep[1]; opt[cur].rep[1] = opt[cur-mlen].rep[0]; opt[cur].rep[0] = opt[cur].off - ZSTD_REP_MOVE; ZSTD_LOG_ENCODE("%d: COPYREP_OFF cur=%d mlen=%d rep=%d rep[1]=%d\n", (int)(inr-base), cur, mlen, opt[cur].rep[0], opt[cur].rep[1]); } else { -#if ZSTD_REP_NUM > 3 - opt[cur].rep[3] = (opt[cur].off > 2) ? opt[cur-mlen].rep[2] : opt[cur-mlen].rep[3]; -#endif opt[cur].rep[2] = (opt[cur].off > 1) ? opt[cur-mlen].rep[1] : opt[cur-mlen].rep[2]; opt[cur].rep[1] = (opt[cur].off > 0) ? opt[cur-mlen].rep[0] : opt[cur-mlen].rep[1]; opt[cur].rep[0] = opt[cur-mlen].rep[opt[cur].off]; @@ -688,21 +682,13 @@ _storeSequence: /* cur, last_pos, best_mlen, best_off have to be set */ ZSTD_LOG_ENCODE("%d/%d: ENCODE literals=%d mlen=%d off=%d rep1=%d rep[1]=%d\n", (int)(ip-base), (int)(iend-base), (int)(litLength), (int)mlen, (int)(offset), (int)rep[0], (int)rep[1]); if (offset >= ZSTD_REP_NUM) { -#if ZSTD_REP_NUM > 3 - rep[3] = rep[2]; -#endif rep[2] = rep[1]; rep[1] = rep[0]; rep[0] = offset - ZSTD_REP_MOVE; } else { if (offset != 0) { size_t temp = rep[offset]; - if (offset != 1) { -#if ZSTD_REP_NUM > 3 - if (offset == 3) rep[3] = rep[2]; -#endif - rep[2] = rep[1]; - } + if (offset != 1) rep[2] = rep[1]; rep[1] = rep[0]; rep[0] = temp; }