added ZSTD_COMPRESSBOUND() as a macro

ZSTD_compressBound() works fine, but is only useful for dynamic allocation.
For static allocation, only a macro can provide the amount during compilation time.
This commit is contained in:
Yann Collet
2017-09-29 23:17:41 -07:00
parent e580dc6a4a
commit 5b10345b26
2 changed files with 3 additions and 4 deletions
+1 -3
View File
@@ -38,9 +38,7 @@
* Helper functions
***************************************/
size_t ZSTD_compressBound(size_t srcSize) {
size_t const lowLimit = 256 KB;
size_t const margin = (srcSize < lowLimit) ? (lowLimit-srcSize) >> 12 : 0; /* from 64 to 0 */
return srcSize + (srcSize >> 8) + margin;
return ZSTD_COMPRESSBOUND(srcSize);
}