diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2024-07-01 19:24:01 -0500 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2024-07-01 19:34:40 -0500 |
commit | e011d8c164402cbb1baf92533dfb4f933ec08fee (patch) | |
tree | 7a28431c3c5caf885f07deac6718787b36f2231c /deflate.c | |
parent | 534864bccd78812648ad1beaccdeec7c9d47aeef (diff) | |
download | zlib-e011d8c164402cbb1baf92533dfb4f933ec08fee.tar.gz zlib-e011d8c164402cbb1baf92533dfb4f933ec08fee.tar.bz2 zlib-e011d8c164402cbb1baf92533dfb4f933ec08fee.zip |
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.
Diffstat (limited to 'deflate.c')
-rw-r--r-- | deflate.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -720,6 +720,14 @@ int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits) { | |||
720 | } | 720 | } |
721 | 721 | ||
722 | /* ========================================================================= */ | 722 | /* ========================================================================= */ |
723 | int ZEXPORT deflateUsed(z_streamp strm, int *bits) { | ||
724 | if (deflateStateCheck(strm)) return Z_STREAM_ERROR; | ||
725 | if (bits != Z_NULL) | ||
726 | *bits = strm->state->bi_used; | ||
727 | return Z_OK; | ||
728 | } | ||
729 | |||
730 | /* ========================================================================= */ | ||
723 | int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) { | 731 | int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) { |
724 | deflate_state *s; | 732 | deflate_state *s; |
725 | int put; | 733 | int put; |