diff options
author | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2021-12-13 22:30:58 +0100 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2021-12-24 12:52:14 +0100 |
commit | 8a378ba9b85e23a6e2e67b01a1b3d738e86faefe (patch) | |
tree | e9e0dc35c97219e5b7276f5c026f28ab6e9f02dd /zutil.h | |
parent | 2faaf5bbc993c09f7344353b824e1c1ad585627f (diff) |
Fix deflateBound and compressBound returning very small size estimates.
Remove workaround in switchlevels.c, so we do actual testing of this.
Use named defines instead of magic numbers where we can.
Diffstat (limited to 'zutil.h')
-rw-r--r-- | zutil.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -78,6 +78,20 @@ extern z_const char * const PREFIX(z_errmsg)[10]; /* indexed by 2-zlib_error */ #define ADLER32_INITIAL_VALUE 1 /* initial adler-32 hash value */ +#define ZLIB_WRAPLEN 6 /* zlib format overhead */ +#define GZIP_WRAPLEN 18 /* gzip format overhead */ + +#define DEFLATE_HEADER_BITS 3 +#define DEFLATE_EOBS_BITS 15 +#define DEFLATE_PAD_BITS 6 +#define DEFLATE_BLOCK_OVERHEAD ((DEFLATE_HEADER_BITS + DEFLATE_EOBS_BITS + DEFLATE_PAD_BITS) >> 3) +/* deflate block overhead: 3 bits for block start + 15 bits for block end + padding to nearest byte */ + +#define DEFLATE_QUICK_LIT_MAX_BITS 9 +#define DEFLATE_QUICK_OVERHEAD(x) ((x * (DEFLATE_QUICK_LIT_MAX_BITS - 8) + 7) >> 3) +/* deflate_quick worst-case overhead: 9 bits per literal, round up to next byte (+7) */ + + /* target dependencies */ #ifdef AMIGA |