fixed remaining searchLength invocations
This commit is contained in:
@@ -263,13 +263,39 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)
|
||||
return bounds;
|
||||
|
||||
case ZSTD_p_targetLength:
|
||||
bounds.lowerBound = ZSTD_TARGETLENGTH_MIN;
|
||||
bounds.upperBound = ZSTD_TARGETLENGTH_MAX;
|
||||
return bounds;
|
||||
|
||||
case ZSTD_p_compressionStrategy:
|
||||
case ZSTD_p_format:
|
||||
bounds.lowerBound = (int)ZSTD_fast;
|
||||
bounds.upperBound = (int)ZSTD_btultra;
|
||||
return bounds;
|
||||
|
||||
case ZSTD_p_contentSizeFlag:
|
||||
bounds.lowerBound = 0;
|
||||
bounds.upperBound = 1;
|
||||
return bounds;
|
||||
|
||||
case ZSTD_p_checksumFlag:
|
||||
bounds.lowerBound = 0;
|
||||
bounds.upperBound = 1;
|
||||
return bounds;
|
||||
|
||||
case ZSTD_p_dictIDFlag:
|
||||
case ZSTD_p_forceMaxWindow :
|
||||
bounds.lowerBound = 0;
|
||||
bounds.upperBound = 1;
|
||||
return bounds;
|
||||
|
||||
case ZSTD_p_nbWorkers:
|
||||
bounds.lowerBound = 0;
|
||||
#ifdef ZSTD_MULTITHREAD
|
||||
bounds.upperBound = ZSTDMT_NBWORKERS_MAX;
|
||||
#else
|
||||
bounds.upperBound = 0;
|
||||
#endif
|
||||
return bounds;
|
||||
|
||||
case ZSTD_p_jobSize:
|
||||
case ZSTD_p_overlapSizeLog:
|
||||
case ZSTD_p_rsyncable:
|
||||
@@ -278,6 +304,13 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)
|
||||
case ZSTD_p_ldmMinMatch:
|
||||
case ZSTD_p_ldmBucketSizeLog:
|
||||
case ZSTD_p_ldmHashEveryLog:
|
||||
|
||||
/* experimental parameters */
|
||||
case ZSTD_p_forceMaxWindow :
|
||||
bounds.lowerBound = 0;
|
||||
bounds.upperBound = 1;
|
||||
return bounds;
|
||||
case ZSTD_p_format:
|
||||
case ZSTD_p_forceAttachDict:
|
||||
default:
|
||||
{ ZSTD_bounds const boundError = { ERROR(parameter_unsupported), 0, 0 };
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
|
||||
/* ====== Tuning parameters ====== */
|
||||
#define ZSTDMT_NBWORKERS_MAX 200
|
||||
#define ZSTDMT_JOBSIZE_MAX (MEM_32bits() ? (512 MB) : (2 GB)) /* note : limited by `jobSize` type, which is `unsigned` */
|
||||
#define ZSTDMT_OVERLAPLOG_DEFAULT 6
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
#include "zstd.h" /* ZSTD_inBuffer, ZSTD_outBuffer, ZSTDLIB_API */
|
||||
|
||||
|
||||
/* === Constants === */
|
||||
#define ZSTDMT_NBWORKERS_MAX 200
|
||||
|
||||
|
||||
/* === Memory management === */
|
||||
typedef struct ZSTDMT_CCtx_s ZSTDMT_CCtx;
|
||||
ZSTDLIB_API ZSTDMT_CCtx* ZSTDMT_createCCtx(unsigned nbWorkers);
|
||||
|
||||
@@ -255,7 +255,7 @@ static dictItem ZDICT_analyzePos(
|
||||
}
|
||||
|
||||
{ int i;
|
||||
U32 searchLength;
|
||||
U32 mml;
|
||||
U32 refinedStart = start;
|
||||
U32 refinedEnd = end;
|
||||
|
||||
@@ -263,7 +263,7 @@ static dictItem ZDICT_analyzePos(
|
||||
DISPLAYLEVEL(4, "found %3u matches of length >= %i at pos %7u ", (U32)(end-start), MINMATCHLENGTH, (U32)pos);
|
||||
DISPLAYLEVEL(4, "\n");
|
||||
|
||||
for (searchLength = MINMATCHLENGTH ; ; searchLength++) {
|
||||
for (mml = MINMATCHLENGTH ; ; mml++) {
|
||||
BYTE currentChar = 0;
|
||||
U32 currentCount = 0;
|
||||
U32 currentID = refinedStart;
|
||||
@@ -271,13 +271,13 @@ static dictItem ZDICT_analyzePos(
|
||||
U32 selectedCount = 0;
|
||||
U32 selectedID = currentID;
|
||||
for (id =refinedStart; id < refinedEnd; id++) {
|
||||
if (b[suffix[id] + searchLength] != currentChar) {
|
||||
if (b[suffix[id] + mml] != currentChar) {
|
||||
if (currentCount > selectedCount) {
|
||||
selectedCount = currentCount;
|
||||
selectedID = currentID;
|
||||
}
|
||||
currentID = id;
|
||||
currentChar = b[ suffix[id] + searchLength];
|
||||
currentChar = b[ suffix[id] + mml];
|
||||
currentCount = 0;
|
||||
}
|
||||
currentCount ++;
|
||||
|
||||
+17
-17
@@ -895,22 +895,22 @@ ZSTDLIB_API size_t ZSTD_decompress_generic(ZSTD_DCtx* dctx,
|
||||
* This limit does not apply to one-pass decoders (such as ZSTD_decompress()), since no additional memory is allocated */
|
||||
|
||||
/* compression parameter bounds */
|
||||
#define ZSTD_WINDOWLOG_MAX_32 30
|
||||
#define ZSTD_WINDOWLOG_MAX_64 31
|
||||
#define ZSTD_WINDOWLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
|
||||
#define ZSTD_WINDOWLOG_MIN 10
|
||||
#define ZSTD_HASHLOG_MAX ((ZSTD_WINDOWLOG_MAX < 30) ? ZSTD_WINDOWLOG_MAX : 30)
|
||||
#define ZSTD_HASHLOG_MIN 6
|
||||
#define ZSTD_CHAINLOG_MAX_32 29
|
||||
#define ZSTD_CHAINLOG_MAX_64 30
|
||||
#define ZSTD_CHAINLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_CHAINLOG_MAX_32 : ZSTD_CHAINLOG_MAX_64))
|
||||
#define ZSTD_CHAINLOG_MIN ZSTD_HASHLOG_MIN
|
||||
#define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1)
|
||||
#define ZSTD_SEARCHLOG_MIN 1
|
||||
#define ZSTD_MINMATCH_MAX 7 /* only for ZSTD_fast, other strategies are limited to 6 */
|
||||
#define ZSTD_MINMATCH_MIN 3 /* only for ZSTD_btopt+, faster strategies are limited to 4 */
|
||||
#define ZSTD_TARGETLENGTH_MAX ZSTD_BLOCKSIZE_MAX
|
||||
#define ZSTD_TARGETLENGTH_MIN 0 /* note : comparing this constant to an unsigned results in a tautological test */
|
||||
#define ZSTD_WINDOWLOG_MAX_32 30
|
||||
#define ZSTD_WINDOWLOG_MAX_64 31
|
||||
#define ZSTD_WINDOWLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_WINDOWLOG_MAX_32 : ZSTD_WINDOWLOG_MAX_64))
|
||||
#define ZSTD_WINDOWLOG_MIN 10
|
||||
#define ZSTD_HASHLOG_MAX ((ZSTD_WINDOWLOG_MAX < 30) ? ZSTD_WINDOWLOG_MAX : 30)
|
||||
#define ZSTD_HASHLOG_MIN 6
|
||||
#define ZSTD_CHAINLOG_MAX_32 29
|
||||
#define ZSTD_CHAINLOG_MAX_64 30
|
||||
#define ZSTD_CHAINLOG_MAX ((int)(sizeof(size_t) == 4 ? ZSTD_CHAINLOG_MAX_32 : ZSTD_CHAINLOG_MAX_64))
|
||||
#define ZSTD_CHAINLOG_MIN ZSTD_HASHLOG_MIN
|
||||
#define ZSTD_SEARCHLOG_MAX (ZSTD_WINDOWLOG_MAX-1)
|
||||
#define ZSTD_SEARCHLOG_MIN 1
|
||||
#define ZSTD_MINMATCH_MAX 7 /* only for ZSTD_fast, other strategies are limited to 6 */
|
||||
#define ZSTD_MINMATCH_MIN 3 /* only for ZSTD_btopt+, faster strategies are limited to 4 */
|
||||
#define ZSTD_TARGETLENGTH_MAX ZSTD_BLOCKSIZE_MAX
|
||||
#define ZSTD_TARGETLENGTH_MIN 0 /* note : comparing this constant to an unsigned results in a tautological test */
|
||||
|
||||
/* LDM parameter bounds */
|
||||
#define ZSTD_LDM_MINMATCH_MAX 4096
|
||||
@@ -927,7 +927,7 @@ typedef struct {
|
||||
unsigned chainLog; /**< fully searched segment : larger == more compression, slower, more memory (useless for fast) */
|
||||
unsigned hashLog; /**< dispatch table : larger == faster, more memory */
|
||||
unsigned searchLog; /**< nb of searches : larger == more compression, slower */
|
||||
unsigned minMatch; /**< match length searched : larger == faster decompression, sometimes less compression */
|
||||
unsigned minMatch; /**< match length searched : larger == faster decompression, sometimes less compression */
|
||||
unsigned targetLength; /**< acceptable match size for optimal parser (only) : larger == more compression, slower */
|
||||
ZSTD_strategy strategy; /**< see ZSTD_strategy definition above */
|
||||
} ZSTD_compressionParameters;
|
||||
|
||||
Reference in New Issue
Block a user