1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-08 17:22:10 +03:00

fullbench: pass proper parameters in scenario 43

This commit is contained in:
Yann Collet
2019-05-29 15:26:06 -07:00
parent c63081623f
commit ed38b645db
4 changed files with 15 additions and 12 deletions

View File

@@ -930,12 +930,12 @@ size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset)
@return : 0, or an error code if one value is beyond authorized range */ @return : 0, or an error code if one value is beyond authorized range */
size_t ZSTD_checkCParams(ZSTD_compressionParameters cParams) size_t ZSTD_checkCParams(ZSTD_compressionParameters cParams)
{ {
BOUNDCHECK(ZSTD_c_windowLog, cParams.windowLog); BOUNDCHECK(ZSTD_c_windowLog, (int)cParams.windowLog);
BOUNDCHECK(ZSTD_c_chainLog, cParams.chainLog); BOUNDCHECK(ZSTD_c_chainLog, (int)cParams.chainLog);
BOUNDCHECK(ZSTD_c_hashLog, cParams.hashLog); BOUNDCHECK(ZSTD_c_hashLog, (int)cParams.hashLog);
BOUNDCHECK(ZSTD_c_searchLog, cParams.searchLog); BOUNDCHECK(ZSTD_c_searchLog, (int)cParams.searchLog);
BOUNDCHECK(ZSTD_c_minMatch, cParams.minMatch); BOUNDCHECK(ZSTD_c_minMatch, (int)cParams.minMatch);
BOUNDCHECK(ZSTD_c_targetLength,cParams.targetLength); BOUNDCHECK(ZSTD_c_targetLength,(int)cParams.targetLength);
BOUNDCHECK(ZSTD_c_strategy, cParams.strategy); BOUNDCHECK(ZSTD_c_strategy, cParams.strategy);
return 0; return 0;
} }
@@ -951,7 +951,7 @@ ZSTD_clampCParams(ZSTD_compressionParameters cParams)
if ((int)val<bounds.lowerBound) val=(type)bounds.lowerBound; \ if ((int)val<bounds.lowerBound) val=(type)bounds.lowerBound; \
else if ((int)val>bounds.upperBound) val=(type)bounds.upperBound; \ else if ((int)val>bounds.upperBound) val=(type)bounds.upperBound; \
} }
# define CLAMP(cParam, val) CLAMP_TYPE(cParam, val, int) # define CLAMP(cParam, val) CLAMP_TYPE(cParam, val, unsigned)
CLAMP(ZSTD_c_windowLog, cParams.windowLog); CLAMP(ZSTD_c_windowLog, cParams.windowLog);
CLAMP(ZSTD_c_chainLog, cParams.chainLog); CLAMP(ZSTD_c_chainLog, cParams.chainLog);
CLAMP(ZSTD_c_hashLog, cParams.hashLog); CLAMP(ZSTD_c_hashLog, cParams.hashLog);

View File

@@ -1094,7 +1094,7 @@ _shortestPath: /* cur, last_pos, best_mlen, best_off have to be set */
} /* while (ip < ilimit) */ } /* while (ip < ilimit) */
/* Return the last literals size */ /* Return the last literals size */
return iend - anchor; return (size_t)(iend - anchor);
} }

View File

@@ -499,6 +499,9 @@ static int benchMem(unsigned benchNb,
case 42 : case 42 :
g_cSize = ZSTD_compress(buff2, dstBuffSize, src, srcSize, cLevel); g_cSize = ZSTD_compress(buff2, dstBuffSize, src, srcSize, cLevel);
break; break;
case 43 :
buff2 = &cparams;
break;
/* test functions */ /* test functions */
/* convention: test functions have ID > 100 */ /* convention: test functions have ID > 100 */

View File

@@ -2464,7 +2464,7 @@ static unsigned readU32FromChar(const char** stringPtr)
* If yes, @return 1 and advances *stringPtr to the position which immediately follows longCommand. * If yes, @return 1 and advances *stringPtr to the position which immediately follows longCommand.
* @return 0 and doesn't modify *stringPtr otherwise. * @return 0 and doesn't modify *stringPtr otherwise.
*/ */
static unsigned longCommandWArg(const char** stringPtr, const char* longCommand) static int longCommandWArg(const char** stringPtr, const char* longCommand)
{ {
size_t const comSize = strlen(longCommand); size_t const comSize = strlen(longCommand);
int const result = !strncmp(*stringPtr, longCommand, comSize); int const result = !strncmp(*stringPtr, longCommand, comSize);
@@ -2524,7 +2524,7 @@ int main(int argc, const char** argv)
case 'i': case 'i':
argument++; maxDuration = 0; argument++; maxDuration = 0;
nbTests = readU32FromChar(&argument); nbTests = (int)readU32FromChar(&argument);
break; break;
case 'T': case 'T':
@@ -2544,12 +2544,12 @@ int main(int argc, const char** argv)
case 't': case 't':
argument++; argument++;
testNb = readU32FromChar(&argument); testNb = (int)readU32FromChar(&argument);
break; break;
case 'P': /* compressibility % */ case 'P': /* compressibility % */
argument++; argument++;
proba = readU32FromChar(&argument); proba = (int)readU32FromChar(&argument);
if (proba>100) proba = 100; if (proba>100) proba = 100;
break; break;