ZSTD_REP_NUM=3 only

This commit is contained in:
inikep
2016-04-05 17:11:56 +02:00
parent d5359b2e55
commit a4385aa23b
3 changed files with 1 additions and 27 deletions
-6
View File
@@ -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;
-6
View File
@@ -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;
+1 -15
View File
@@ -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;
}