aboutsummaryrefslogtreecommitdiff
path: root/deflate.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2024-07-01 19:24:01 -0500
committerMark Adler <madler@alumni.caltech.edu>2024-07-01 19:34:40 -0500
commite011d8c164402cbb1baf92533dfb4f933ec08fee (patch)
tree7a28431c3c5caf885f07deac6718787b36f2231c /deflate.c
parent534864bccd78812648ad1beaccdeec7c9d47aeef (diff)
downloadzlib-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.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/deflate.c b/deflate.c
index cbdd880..0c9aa6d 100644
--- a/deflate.c
+++ b/deflate.c
@@ -720,6 +720,14 @@ int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits) {
720} 720}
721 721
722/* ========================================================================= */ 722/* ========================================================================= */
723int 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/* ========================================================================= */
723int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) { 731int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
724 deflate_state *s; 732 deflate_state *s;
725 int put; 733 int put;