simplify BMK_syntheticTest()
This commit is contained in:
+10
-6
@@ -697,9 +697,9 @@ static BMK_benchOutcome_t BMK_benchCLevel(const void* srcBuffer, size_t benchedS
|
||||
displayLevel, displayName, adv);
|
||||
}
|
||||
|
||||
BMK_benchOutcome_t BMK_syntheticTest(int cLevel, double compressibility,
|
||||
const ZSTD_compressionParameters* compressionParams,
|
||||
int displayLevel, const BMK_advancedParams_t* adv)
|
||||
int BMK_syntheticTest(int cLevel, double compressibility,
|
||||
const ZSTD_compressionParameters* compressionParams,
|
||||
int displayLevel, const BMK_advancedParams_t* adv)
|
||||
{
|
||||
char name[20] = {0};
|
||||
size_t const benchedSize = 10000000;
|
||||
@@ -707,12 +707,16 @@ BMK_benchOutcome_t BMK_syntheticTest(int cLevel, double compressibility,
|
||||
BMK_benchOutcome_t res;
|
||||
|
||||
if (cLevel > ZSTD_maxCLevel()) {
|
||||
RETURN_ERROR(15, BMK_benchOutcome_t, "Invalid Compression Level");
|
||||
DISPLAYLEVEL(1, "Invalid Compression Level");
|
||||
return 15;
|
||||
}
|
||||
|
||||
/* Memory allocation */
|
||||
srcBuffer = malloc(benchedSize);
|
||||
if (!srcBuffer) RETURN_ERROR(21, BMK_benchOutcome_t, "not enough memory");
|
||||
if (!srcBuffer) {
|
||||
DISPLAYLEVEL(1, "allocation error : not enough memory");
|
||||
return 16;
|
||||
}
|
||||
|
||||
/* Fill input buffer */
|
||||
RDG_genBuffer(srcBuffer, benchedSize, compressibility, 0.0, 0);
|
||||
@@ -728,7 +732,7 @@ BMK_benchOutcome_t BMK_syntheticTest(int cLevel, double compressibility,
|
||||
/* clean up */
|
||||
free(srcBuffer);
|
||||
|
||||
return res;
|
||||
return !BMK_isSuccessful_benchOutcome(res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user