]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix ZSTD_COMPRESSBOUND() macro
authorYann Collet <cyan@fb.com>
Sat, 18 Nov 2017 19:16:39 +0000 (11:16 -0800)
committerYann Collet <cyan@fb.com>
Sat, 18 Nov 2017 19:16:39 +0000 (11:16 -0800)
It was using macro `KB`, which is not defined in `zstd.h`.

lib/zstd.h

index f07c9eed2f4d8f718d3bd4b0844ca3cd67d9246d..919d1e2e0c8b33df16fb3db4406421fc7e94dc43 100644 (file)
@@ -131,7 +131,7 @@ ZSTDLIB_API unsigned long long ZSTD_getDecompressedSize(const void* src, size_t
 
 
 /*======  Helper functions  ======*/
-#define ZSTD_COMPRESSBOUND(srcSize)   ((srcSize) + ((srcSize)>>8) + (((srcSize) < 128 KB) ? ((128 KB - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0))  /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
+#define ZSTD_COMPRESSBOUND(srcSize)   ((srcSize) + ((srcSize)>>8) + (((srcSize) < (128<<10)) ? (((128<<10) - (srcSize)) >> 11) /* margin, from 64 to 0 */ : 0))  /* this formula ensures that bound(A) + bound(B) <= bound(A+B) as long as A and B >= 128 KB */
 ZSTDLIB_API size_t      ZSTD_compressBound(size_t srcSize); /*!< maximum compressed size in worst case scenario */
 ZSTDLIB_API unsigned    ZSTD_isError(size_t code);          /*!< tells if a `size_t` function result is an error code */
 ZSTDLIB_API const char* ZSTD_getErrorName(size_t code);     /*!< provides readable string from an error code */