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 /trees.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 'trees.c')
-rw-r--r-- | trees.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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; |