added ZSTD_estimateCDictSize() and ZSTD_estimateDDictSize()

it complements ZSTD_estimateCCtxSize()
for the special case of ZSTD_initCStream_usingDict()
This commit is contained in:
Yann Collet committed 2017-05-08 17:51:49 -07:00
1 parent 7855366598
commit a1d6704d7f
5 files changed
+57 -13

No files matched your search

+8
View File
@@ -1969,6 +1969,14 @@ 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)
{
return dictSize + sizeof(ZSTD_DDict);
}
size_t ZSTD_sizeof_DDict(const ZSTD_DDict* ddict)
{
if (ddict==NULL) return 0; /* support sizeof on NULL */