From: inikep Date: Mon, 4 Apr 2016 12:54:53 +0000 (+0200) Subject: Merge remote-tracking branch 'refs/remotes/Cyan4973/dev060' into dev X-Git-Tag: v0.6.0^2~17^2~17^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c7456c5b7d5fb6fb93daba66cf0a8bad03da9f0;p=thirdparty%2Fzstd.git Merge remote-tracking branch 'refs/remotes/Cyan4973/dev060' into dev # Conflicts: # lib/zstd_compress.c # lib/zstd_static.h --- 0c7456c5b7d5fb6fb93daba66cf0a8bad03da9f0 diff --cc lib/zstd_compress.c index 1c07a173b,219b13f82..07c72f971 --- a/lib/zstd_compress.c +++ b/lib/zstd_compress.c @@@ -218,10 -217,10 +218,10 @@@ static size_t ZSTD_resetCCtx_advanced ( const U32 divider = (params.cParams.searchLength==3) ? 3 : 4; const size_t maxNbSeq = blockSize / divider; const size_t tokenSpace = blockSize + 11*maxNbSeq; - const size_t contentSize = (params.cParams.strategy == ZSTD_fast) ? 0 : (1 << params.cParams.contentLog); + const size_t chainSize = (params.cParams.strategy == ZSTD_fast) ? 0 : (1 << params.cParams.chainLog); const size_t hSize = 1 << params.cParams.hashLog; - const size_t h3Size = (params.cParams.searchLength==3) ? (1 << HASHLOG3) : 0; + const size_t h3Size = (zc->hashLog3) ? 1 << zc->hashLog3 : 0; - const size_t tableSpace = (contentSize + hSize + h3Size) * sizeof(U32); + const size_t tableSpace = (chainSize + hSize + h3Size) * sizeof(U32); /* Check if workSpace is large enough, alloc a new one if needed */ { size_t const optSpace = ((MaxML+1) + (MaxLL+1) + (1<params); /* copy tables */ - { const size_t contentSize = (srcCCtx->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << srcCCtx->params.cParams.contentLog); - { const size_t chaineSize = (srcCCtx->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << srcCCtx->params.cParams.chainLog); ++ { const size_t chainSize = (srcCCtx->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << srcCCtx->params.cParams.chainLog); const size_t hSize = 1 << srcCCtx->params.cParams.hashLog; - const size_t h3Size = (srcCCtx->params.cParams.searchLength == 3) ? (1 << HASHLOG3) : 0; - const size_t tableSpace = (chaineSize + hSize + h3Size) * sizeof(U32); + const size_t h3Size = (srcCCtx->hashLog3) ? 1 << srcCCtx->hashLog3 : 0; - const size_t tableSpace = (contentSize + hSize + h3Size) * sizeof(U32); ++ const size_t tableSpace = (chainSize + hSize + h3Size) * sizeof(U32); memcpy(dstCCtx->workSpace, srcCCtx->workSpace, tableSpace); } @@@ -343,10 -341,10 +343,10 @@@ static void ZSTD_reduceIndex (ZSTD_CCtx { const U32 hSize = 1 << zc->params.cParams.hashLog; ZSTD_reduceTable(zc->hashTable, hSize, reducerValue); } - { const U32 contentSize = (zc->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << zc->params.cParams.contentLog); - ZSTD_reduceTable(zc->contentTable, contentSize, reducerValue); } + { const U32 chainSize = (zc->params.cParams.strategy == ZSTD_fast) ? 0 : (1 << zc->params.cParams.chainLog); + ZSTD_reduceTable(zc->chainTable, chainSize, reducerValue); } - { const U32 h3Size = (zc->params.cParams.searchLength == 3) ? (1 << HASHLOG3) : 0; + { const U32 h3Size = (zc->hashLog3) ? 1 << zc->hashLog3 : 0; ZSTD_reduceTable(zc->hashTable3, h3Size, reducerValue); } } @@@ -2538,7 -2530,14 +2538,11 @@@ ZSTD_compressionParameters ZSTD_getCPar U32 const tableID = (rSize <= 256 KB) + (rSize <= 128 KB) + (rSize <= 16 KB); /* intentional underflow for srcSizeHint == 0 */ if (compressionLevel<=0) compressionLevel = 1; if (compressionLevel > ZSTD_MAX_CLEVEL) compressionLevel = ZSTD_MAX_CLEVEL; -#if ZSTD_OPT_DEBUG >= 1 - tableID=0; -#endif cp = ZSTD_defaultCParameters[tableID][compressionLevel]; - if (cp.windowLog > ZSTD_WINDOWLOG_MAX) cp.windowLog = ZSTD_WINDOWLOG_MAX; /* auto-correction, for 32-bits mode */ + if (MEM_32bits()) { /* auto-correction, for 32-bits mode */ + if (cp.windowLog > ZSTD_WINDOWLOG_MAX) cp.windowLog = ZSTD_WINDOWLOG_MAX; + if (cp.chainLog > ZSTD_CHAINLOG_MAX) cp.chainLog = ZSTD_CHAINLOG_MAX; + if (cp.hashLog > ZSTD_HASHLOG_MAX) cp.hashLog = ZSTD_HASHLOG_MAX; + } return cp; } diff --cc lib/zstd_static.h index 52d7193ef,2f11ceeb6..1af43279e --- a/lib/zstd_static.h +++ b/lib/zstd_static.h @@@ -59,13 -59,11 +59,13 @@@ extern "C" ***************************************/ #define ZSTD_WINDOWLOG_MAX (MEM_32bits() ? 25 : 27) #define ZSTD_WINDOWLOG_MIN 18 - #define ZSTD_CONTENTLOG_MAX (ZSTD_WINDOWLOG_MAX+1) - #define ZSTD_CONTENTLOG_MIN 4 - #define ZSTD_HASHLOG_MAX 28 + #define ZSTD_CHAINLOG_MAX (ZSTD_WINDOWLOG_MAX+1) + #define ZSTD_CHAINLOG_MIN 4 + #define ZSTD_HASHLOG_MAX ZSTD_WINDOWLOG_MAX #define ZSTD_HASHLOG_MIN 12 +#define ZSTD_HASHLOG3_MAX 17 +#define ZSTD_HASHLOG3_MIN 15 - #define ZSTD_SEARCHLOG_MAX (ZSTD_CONTENTLOG_MAX-1) + #define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1) #define ZSTD_SEARCHLOG_MIN 1 #define ZSTD_SEARCHLENGTH_MAX 7 #define ZSTD_SEARCHLENGTH_MIN 3