removed kSlotNew

This commit is contained in:
inikep
2016-04-05 10:18:37 +02:00
parent b3532793a9
commit 74e3a7ba4c
5 changed files with 8 additions and 38 deletions
-7
View 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];
-7
View 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;
-12
View File
@@ -46,17 +46,6 @@
#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);
+8 -9
View 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];
-3
View 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));