]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
ZSTD_REP_NUM=3 only
authorinikep <inikep@gmail.com>
Tue, 5 Apr 2016 15:11:56 +0000 (17:11 +0200)
committerinikep <inikep@gmail.com>
Tue, 5 Apr 2016 15:11:56 +0000 (17:11 +0200)
lib/zstd_compress.c
lib/zstd_decompress.c
lib/zstd_opt.h

index 95cd8ff2d1f7e96a38adfe9a6244e537b074c720..5fcdc6e02b1630b91e991b5cfc34e6025c292d87 100644 (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;
index 037b6cb2e4d807eba7cc0826c96333c321a222e9..64ff6c9a1320828925efb3bc85a5e0922c1181f7 100644 (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;
index 0038232305bf3cffac8f33f661974d5dda27d44a..4b942d72b2f0c33fe0b817c883e72d8ef81c26a3 100644 (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;
                 }