From: Yann Collet Date: Fri, 17 Jun 2016 10:54:52 +0000 (+0200) Subject: Joined `seqStore` initialization at dispatch point X-Git-Tag: v0.7.1~2^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19cab46f2f2ae3e512c00df98043083101410810;p=thirdparty%2Fzstd.git Joined `seqStore` initialization at dispatch point --- diff --git a/.gitignore b/.gitignore index a06c2afa2..181652401 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ *.dylib # Executables +zstd *.exe *.out *.app diff --git a/Makefile b/Makefile index 18db04245..77a67a231 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,7 @@ all: zstdprogram: $(MAKE) -C $(PRGDIR) + mv $(PRGDIR)/zstd . zlibwrapper: $(MAKE) -C $(ZSTDDIR) all diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 1ae321838..b8d1d2c0a 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1128,7 +1128,6 @@ void ZSTD_compressBlock_fast_generic(ZSTD_CCtx* cctx, size_t offset_1=cctx->rep[0], offset_2=cctx->rep[1]; /* init */ - ZSTD_resetSeqStore(seqStorePtr); ip += (ip==lowest); { U32 const maxRep = (U32)(ip-lowest); if (offset_1 > maxRep) offset_1 = 0; @@ -1239,7 +1238,6 @@ static void ZSTD_compressBlock_fast_extDict_generic(ZSTD_CCtx* ctx, U32 offset_1=ctx->rep[0], offset_2=ctx->rep[1]; /* init */ - ZSTD_resetSeqStore(seqStorePtr); /* skip first position to avoid read overflow during repcode match check */ hashTable[ZSTD_hashPtr(ip, hBits, mls)] = (U32)(ip-base); ip++; @@ -1743,7 +1741,6 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx* ctx, /* init */ ip += (ip==base); ctx->nextToUpdate3 = ctx->nextToUpdate; - ZSTD_resetSeqStore(seqStorePtr); { U32 i; U32 const maxRep = (U32)(ip-base); for (i=0; irep[i]; } ctx->nextToUpdate3 = ctx->nextToUpdate; - ZSTD_resetSeqStore(seqStorePtr); ip += (ip == prefixStart); /* Match Loop */ @@ -2097,11 +2093,7 @@ typedef void (*ZSTD_blockCompressor) (ZSTD_CCtx* ctx, const void* src, size_t sr static ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int extDict) { static const ZSTD_blockCompressor blockCompressor[2][6] = { -#if 1 { ZSTD_compressBlock_fast, ZSTD_compressBlock_greedy, ZSTD_compressBlock_lazy, ZSTD_compressBlock_lazy2, ZSTD_compressBlock_btlazy2, ZSTD_compressBlock_btopt }, -#else - { ZSTD_compressBlock_fast_extDict, ZSTD_compressBlock_greedy_extDict, ZSTD_compressBlock_lazy_extDict,ZSTD_compressBlock_lazy2_extDict, ZSTD_compressBlock_btlazy2_extDict, ZSTD_compressBlock_btopt_extDict }, -#endif { ZSTD_compressBlock_fast_extDict, ZSTD_compressBlock_greedy_extDict, ZSTD_compressBlock_lazy_extDict,ZSTD_compressBlock_lazy2_extDict, ZSTD_compressBlock_btlazy2_extDict, ZSTD_compressBlock_btopt_extDict } }; @@ -2111,8 +2103,9 @@ static ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc, void* dst, size_t dstCapacity, const void* src, size_t srcSize) { - ZSTD_blockCompressor blockCompressor = ZSTD_selectBlockCompressor(zc->params.cParams.strategy, zc->lowLimit < zc->dictLimit); + ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->params.cParams.strategy, zc->lowLimit < zc->dictLimit); if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1) return 0; /* don't even attempt compression below a certain srcSize */ + ZSTD_resetSeqStore(&(zc->seqStore)); blockCompressor(zc, src, srcSize); return ZSTD_compressSequences(zc, dst, dstCapacity, srcSize); } diff --git a/lib/compress/zstd_opt.h b/lib/compress/zstd_opt.h index 8b15bf6ad..97b1623ba 100644 --- a/lib/compress/zstd_opt.h +++ b/lib/compress/zstd_opt.h @@ -465,7 +465,6 @@ void ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx, /* init */ ctx->nextToUpdate3 = ctx->nextToUpdate; - ZSTD_resetSeqStore(seqStorePtr); ZSTD_rescaleFreqs(seqStorePtr); ip += (ip==prefixStart); { U32 i; for (i=0; irep[i]; } @@ -757,7 +756,6 @@ void ZSTD_compressBlock_opt_extDict_generic(ZSTD_CCtx* ctx, { U32 i; for (i=0; irep[i]; } ctx->nextToUpdate3 = ctx->nextToUpdate; - ZSTD_resetSeqStore(seqStorePtr); ZSTD_rescaleFreqs(seqStorePtr); ip += (ip==prefixStart); diff --git a/programs/.gitignore b/programs/.gitignore index 5f50de0dd..cbe39dcdf 100644 --- a/programs/.gitignore +++ b/programs/.gitignore @@ -50,3 +50,4 @@ afl # Misc files *.bat fileTests.sh +dirTest*