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:
Yann Collet
2017-05-25 15:07:37 -07:00
parent 0fdc71c3dc
commit 25989e361c
6 changed files with 53 additions and 18 deletions
+3 -3
View File
@@ -2053,10 +2053,10 @@ size_t ZSTD_freeDDict(ZSTD_DDict* ddict)
/*! ZSTD_estimateDDictSize() :
* Estimate amount of memory that will be needed to create a dictionary for decompression.
* Note : if dictionary is created "byReference", reduce this amount by dictSize */
size_t ZSTD_estimateDDictSize(size_t dictSize)
* Note : dictionary created "byReference" are smaller */
size_t ZSTD_estimateDDictSize(size_t dictSize, unsigned byReference)
{
return dictSize + sizeof(ZSTD_DDict);
return sizeof(ZSTD_DDict) + (byReference ? 0 : dictSize);
}
size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict)