]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Merge remote-tracking branch 'refs/remotes/Cyan4973/dev060' into dev
authorinikep <inikep@gmail.com>
Mon, 4 Apr 2016 12:54:53 +0000 (14:54 +0200)
committerinikep <inikep@gmail.com>
Mon, 4 Apr 2016 12:54:53 +0000 (14:54 +0200)
# Conflicts:
# lib/zstd_compress.c
# lib/zstd_static.h

1  2 
lib/zstd_compress.c
lib/zstd_opt.h
lib/zstd_static.h
programs/paramgrill.c

index 1c07a173b693c9cda35eba01a0d9b973c34081cf,219b13f828e9d5cb54b888c9cf9f38c7e95c6a3b..07c72f9715f0e70f89e42bf77a6b5a4e60adaccf
@@@ -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<<Offbits) + (1<<Litbits))*sizeof(U32)
@@@ -291,10 -289,10 +291,10 @@@ size_t ZSTD_copyCCtx(ZSTD_CCtx* dstCCtx
      ZSTD_resetCCtx_advanced(dstCCtx, srcCCtx->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_opt.h
Simple merge
index 52d7193ef68cea8d5085bab344dc795ce565391f,2f11ceeb6008488abda118771a7a93f5e7eddfc5..1af43279e4a0ed6bd33441711e26e4c0a8f780c9
@@@ -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_SEARCHLOG_MAX    (ZSTD_CONTENTLOG_MAX-1)
 +#define ZSTD_HASHLOG3_MAX      17
 +#define ZSTD_HASHLOG3_MIN      15
+ #define ZSTD_SEARCHLOG_MAX    (ZSTD_WINDOWLOG_MAX-1)
  #define ZSTD_SEARCHLOG_MIN      1
  #define ZSTD_SEARCHLENGTH_MAX   7
  #define ZSTD_SEARCHLENGTH_MIN   3
Simple merge