From e011d8c164402cbb1baf92533dfb4f933ec08fee Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Mon, 1 Jul 2024 19:24:01 -0500 Subject: Add deflateUsed() function to get the used bits in the last byte. This returns the number of used bits in the last byte of a stream that has just been compressed with deflate. --- zlib.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'zlib.h') diff --git a/zlib.h b/zlib.h index 5498b54..ad33815 100644 --- a/zlib.h +++ b/zlib.h @@ -791,6 +791,18 @@ ZEXTERN int ZEXPORT deflatePending(z_streamp strm, stream state was inconsistent. */ +ZEXTERN int ZEXPORT deflateUsed(z_streamp strm, + int *bits); +/* + deflateUsed() returns in *bits the most recent number of deflate bits used + in the last byte when flushing to a byte boundary. The result is in 1..8, or + 0 if there has not yet been a flush. This helps determine the location of + the last bit of a deflate stream. + + deflateUsed returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + ZEXTERN int ZEXPORT deflatePrime(z_streamp strm, int bits, int value); -- cgit v1.2.3-55-g6feb