aboutsummaryrefslogtreecommitdiff
path: root/trees.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 /trees.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 'trees.c')
-rw-r--r--trees.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/trees.c b/trees.c
index 979ae41..e052a47 100644
--- a/trees.c
+++ b/trees.c
@@ -184,6 +184,7 @@ local void bi_windup(deflate_state *s) {
184 } else if (s->bi_valid > 0) { 184 } else if (s->bi_valid > 0) {
185 put_byte(s, (Byte)s->bi_buf); 185 put_byte(s, (Byte)s->bi_buf);
186 } 186 }
187 s->bi_used = ((s->bi_valid - 1) & 7) + 1;
187 s->bi_buf = 0; 188 s->bi_buf = 0;
188 s->bi_valid = 0; 189 s->bi_valid = 0;
189#ifdef ZLIB_DEBUG 190#ifdef ZLIB_DEBUG
@@ -466,6 +467,7 @@ void ZLIB_INTERNAL _tr_init(deflate_state *s) {
466 467
467 s->bi_buf = 0; 468 s->bi_buf = 0;
468 s->bi_valid = 0; 469 s->bi_valid = 0;
470 s->bi_used = 0;
469#ifdef ZLIB_DEBUG 471#ifdef ZLIB_DEBUG
470 s->compressed_len = 0L; 472 s->compressed_len = 0L;
471 s->bits_sent = 0L; 473 s->bits_sent = 0L;