Changed ZSTD_compressBound()
required so that if Total = A+B compressBound(Total) <= compressBound(A) + compressBound(B) under condition of a minimum size for A and B Will help for ZSTDMT_compress() memory allocation
This commit is contained in:
parent
7b70a1969e
commit
3f75d52527
@ -32,7 +32,10 @@ typedef enum { ZSTDcs_created=0, ZSTDcs_init, ZSTDcs_ongoing, ZSTDcs_ending } ZS
|
|||||||
* Helper functions
|
* Helper functions
|
||||||
***************************************/
|
***************************************/
|
||||||
#define ZSTD_STATIC_ASSERT(c) { enum { ZSTD_static_assert = 1/(int)(!!(c)) }; }
|
#define ZSTD_STATIC_ASSERT(c) { enum { ZSTD_static_assert = 1/(int)(!!(c)) }; }
|
||||||
size_t ZSTD_compressBound(size_t srcSize) { return FSE_compressBound(srcSize) + 12; }
|
size_t ZSTD_compressBound(size_t srcSize) {
|
||||||
|
size_t const margin = (srcSize < 512 KB) ? 16 : 0;
|
||||||
|
return srcSize + (srcSize >> 8) + margin;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-*************************************
|
/*-*************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user