]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
removed kSlotNew
authorinikep <inikep@gmail.com>
Tue, 5 Apr 2016 08:18:37 +0000 (10:18 +0200)
committerinikep <inikep@gmail.com>
Tue, 5 Apr 2016 08:18:37 +0000 (10:18 +0200)
lib/zstd_compress.c
lib/zstd_decompress.c
lib/zstd_internal.h
lib/zstd_opt.h
programs/bench.c

index 38b3f608313ea0fbfbb059af57d81f458c81997e..e1ca3021e4742ff6259f49f46c3e206b13ed9c81 100644 (file)
@@ -1738,17 +1738,10 @@ _storeSequence:
         {
 #if ZSTD_REP_NUM == 4
             if (offset >= ZSTD_REP_NUM) {
-#if 1
                 rep[3] = rep[2];
                 rep[2] = rep[1];
                 rep[1] = rep[0];
                 rep[0] = offset - ZSTD_REP_MOVE;
-#else
-                if (kSlotNew < 3) rep[3] = rep[2];
-                if (kSlotNew < 2) rep[2] = rep[1];
-                if (kSlotNew < 1) rep[1] = rep[0];               
-                rep[kSlotNew] = offset - ZSTD_REP_MOVE;
-#endif
             } else {
                 if (offset != 0) {
                     size_t temp = rep[offset];
index 65d214a2108b4598003ca41f118767eff671b59c..6ad49ee7afcd10953261c93d750445e1172ef714 100644 (file)
@@ -727,17 +727,10 @@ static void ZSTD_decodeSequence(seq_t* seq, seqState_t* seqState, const U32 mls)
                 }
             } else {
                 offset -= ZSTD_REP_MOVE;
-    #if 1 // faster without kSlotNew
                 seqState->prevOffset[3] = seqState->prevOffset[2];
                 seqState->prevOffset[2] = seqState->prevOffset[1];
                 seqState->prevOffset[1] = seqState->prevOffset[0];               
                 seqState->prevOffset[0] = offset;
-    #else
-                if (kSlotNew < 3) seqState->prevOffset[3] = seqState->prevOffset[2];
-                if (kSlotNew < 2) seqState->prevOffset[2] = seqState->prevOffset[1];
-                if (kSlotNew < 1) seqState->prevOffset[1] = seqState->prevOffset[0];               
-                seqState->prevOffset[kSlotNew] = offset;
-    #endif
             }
         }
         seq->offset = offset;
index c3ad3e1c98a642328c38e78eeca36d4bb363800d..951617d5d3dbb3f853e57d3f1cda125f14c62e7a 100644 (file)
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 #define MAX(a,b) ((a)>(b) ? (a) : (b))
 
-#define ZSTD_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
-
-#if (ZSTD_GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__)
-#  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
-#else
-#  define expect(expr,value)    (expr)
-#endif
-
-#define likely(expr)     expect((expr) != 0, 1)
-#define unlikely(expr)   expect((expr) != 0, 0)
-
 
 /*-*************************************
 *  Common constants
@@ -256,7 +245,6 @@ typedef struct {
     ZSTD_stats_t stats;
 } seqStore_t;
 
-extern int kSlotNew;
 const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx);
 void ZSTD_seqToCodes(const seqStore_t* seqStorePtr, size_t const nbSeq);
 size_t ZSTD_compressBegin_targetSrcSize(ZSTD_CCtx* zc, const void* dict, size_t dictSize, size_t targetSrcSize, int compressionLevel);
index 84cb406cee7cda041494004429bbcd5a1b107b98..684eedb11f00612e339a64ba5dce8e62eb7bc7c1 100644 (file)
@@ -551,11 +551,10 @@ void ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx,
            mlen = opt[cur].mlen;
 
            if (opt[cur].off >= ZSTD_REP_NUM) {
-                opt[cur].rep[3] = (kSlotNew < 3) ? opt[cur-mlen].rep[2] : opt[cur-mlen].rep[3];
-                opt[cur].rep[2] = (kSlotNew < 2) ? opt[cur-mlen].rep[1] : opt[cur-mlen].rep[2];
-                opt[cur].rep[1] = (kSlotNew < 1) ? opt[cur-mlen].rep[0] : opt[cur-mlen].rep[1];
-                opt[cur].rep[0] = opt[cur-mlen].rep[0];
-                opt[cur].rep[kSlotNew] = opt[cur].off - ZSTD_REP_MOVE;               
+                opt[cur].rep[3] = opt[cur-mlen].rep[2];
+                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 {
                 opt[cur].rep[3] = (opt[cur].off > 2) ? opt[cur-mlen].rep[2] : opt[cur-mlen].rep[3];
@@ -685,10 +684,10 @@ _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 (kSlotNew < 3) rep[3] = rep[2];
-                if (kSlotNew < 2) rep[2] = rep[1];
-                if (kSlotNew < 1) rep[1] = rep[0];               
-                rep[kSlotNew] = offset - ZSTD_REP_MOVE;               
+                rep[3] = rep[2];
+                rep[2] = rep[1];
+                rep[1] = rep[0];               
+                rep[0] = offset - ZSTD_REP_MOVE;               
             } else {
                 if (offset != 0) {
                     size_t temp = rep[offset];
index 53460fa4001821d4c965fbcad077aa5dc2aff04b..cea9634c2cdf1e4867e63a6675b3bb8aeae4ce4c 100644 (file)
@@ -234,8 +234,6 @@ typedef struct
 #define MIN(a,b) ((a)<(b) ? (a) : (b))
 #define MAX(a,b) ((a)>(b) ? (a) : (b))
 
-int kSlotNew = 0;
-
 static int BMK_benchMem(const void* srcBuffer, size_t srcSize,
                         const char* displayName, int cLevel,
                         const size_t* fileSizes, U32 nbFiles,
@@ -460,7 +458,6 @@ static void BMK_benchCLevel(void* srcBuffer, size_t benchedSize,
     memset(&result, 0, sizeof(result));
     memset(&total, 0, sizeof(total));
 
-    kSlotNew = g_additionalParam;
     if (g_displayLevel == 1 && !g_additionalParam)
         DISPLAY("bench %s: input %u bytes, %i iterations, %u KB blocks\n", ZSTD_VERSION, (U32)benchedSize, g_nbIterations, (U32)(g_blockSize>>10));