updated ZSTD_estimate?DictSize() to pass parameter byReference
resulting ?Dict object is smaller when created byReference. Seems better than a documentation note.
This commit is contained in:
+4
-3
@@ -490,14 +490,15 @@ static int basicUnitTests(U32 seed, double compressibility)
|
||||
|
||||
DISPLAYLEVEL(4, "test%3i : estimate CDict size : ", testNb++);
|
||||
{ ZSTD_compressionParameters const cParams = ZSTD_getCParams(1, CNBuffSize, dictSize);
|
||||
size_t const estimatedSize = ZSTD_estimateCDictSize(cParams, dictSize);
|
||||
size_t const estimatedSize = ZSTD_estimateCDictSize(cParams, dictSize, 1);
|
||||
DISPLAYLEVEL(4, "OK : %u \n", (U32)estimatedSize);
|
||||
}
|
||||
|
||||
DISPLAYLEVEL(4, "test%3i : compress with preprocessed dictionary : ", testNb++);
|
||||
{ ZSTD_compressionParameters const cParams = ZSTD_getCParams(1, CNBuffSize, dictSize);
|
||||
ZSTD_customMem customMem = { NULL, NULL, NULL };
|
||||
ZSTD_CDict* cdict = ZSTD_createCDict_advanced(dictBuffer, dictSize, 1, cParams, customMem);
|
||||
ZSTD_customMem const customMem = { NULL, NULL, NULL };
|
||||
ZSTD_CDict* const cdict = ZSTD_createCDict_advanced(dictBuffer, dictSize,
|
||||
1 /* by Referece */, cParams, customMem);
|
||||
cSize = ZSTD_compress_usingCDict(cctx, compressedBuffer, ZSTD_compressBound(CNBuffSize),
|
||||
CNBuffer, CNBuffSize, cdict);
|
||||
ZSTD_freeCDict(cdict);
|
||||
|
||||
+4
-2
@@ -209,7 +209,8 @@ static int basicUnitTests(U32 seed, double compressibility, ZSTD_customMem custo
|
||||
DISPLAYLEVEL(3, "test%3i : estimate CStream size : ", testNb++);
|
||||
{ ZSTD_compressionParameters const cParams = ZSTD_getCParams(1, CNBufferSize, dictSize);
|
||||
size_t const s = ZSTD_estimateCStreamSize(cParams)
|
||||
+ ZSTD_estimateCDictSize(cParams, dictSize); /* uses ZSTD_initCStream_usingDict() */
|
||||
/* uses ZSTD_initCStream_usingDict() */
|
||||
+ ZSTD_estimateCDictSize(cParams, dictSize, 0);
|
||||
if (ZSTD_isError(s)) goto _output_error;
|
||||
DISPLAYLEVEL(3, "OK (%u bytes) \n", (U32)s);
|
||||
}
|
||||
@@ -281,7 +282,8 @@ static int basicUnitTests(U32 seed, double compressibility, ZSTD_customMem custo
|
||||
if (gfhError!=0) goto _output_error;
|
||||
DISPLAYLEVEL(5, " (windowSize : %u) ", fhi.windowSize);
|
||||
{ size_t const s = ZSTD_estimateDStreamSize(fhi)
|
||||
+ ZSTD_estimateDDictSize(dictSize); /* uses ZSTD_initDStream_usingDict() */
|
||||
/* uses ZSTD_initDStream_usingDict() */
|
||||
+ ZSTD_estimateDDictSize(dictSize, 0);
|
||||
if (ZSTD_isError(s)) goto _output_error;
|
||||
DISPLAYLEVEL(3, "OK (%u bytes) \n", (U32)s);
|
||||
} }
|
||||
|
||||
Reference in New Issue
Block a user