mirror of
https://github.com/GerbilSoft/zlib-ng.git
synced 2025-06-18 11:35:35 -04:00
Remove branch that is almost impossible to hit in bi_flush().
Add case that handles sizes >=48.
This commit is contained in:
parent
20498320cd
commit
6f5bdddad1
39
trees.c
39
trees.c
@ -791,26 +791,25 @@ static int detect_data_type(deflate_state *s) {
|
||||
* Flush the bit buffer, keeping at most 7 bits in it.
|
||||
*/
|
||||
static void bi_flush(deflate_state *s) {
|
||||
if (s->bi_valid == 64) {
|
||||
put_uint64(s, s->bi_buf);
|
||||
s->bi_buf = 0;
|
||||
s->bi_valid = 0;
|
||||
} else {
|
||||
if (s->bi_valid >= 32) {
|
||||
put_uint32(s, (uint32_t)s->bi_buf);
|
||||
s->bi_buf >>= 32;
|
||||
s->bi_valid -= 32;
|
||||
}
|
||||
if (s->bi_valid >= 16) {
|
||||
put_short(s, (uint16_t)s->bi_buf);
|
||||
s->bi_buf >>= 16;
|
||||
s->bi_valid -= 16;
|
||||
}
|
||||
if (s->bi_valid >= 8) {
|
||||
put_byte(s, s->bi_buf);
|
||||
s->bi_buf >>= 8;
|
||||
s->bi_valid -= 8;
|
||||
}
|
||||
if (s->bi_valid >= 48) {
|
||||
put_uint32(s, (uint32_t)s->bi_buf);
|
||||
put_short(s, (uint16_t)(s->bi_buf >> 32));
|
||||
s->bi_buf >>= 48;
|
||||
s->bi_valid -= 48;
|
||||
} else if (s->bi_valid >= 32) {
|
||||
put_uint32(s, (uint32_t)s->bi_buf);
|
||||
s->bi_buf >>= 32;
|
||||
s->bi_valid -= 32;
|
||||
}
|
||||
if (s->bi_valid >= 16) {
|
||||
put_short(s, (uint16_t)s->bi_buf);
|
||||
s->bi_buf >>= 16;
|
||||
s->bi_valid -= 16;
|
||||
}
|
||||
if (s->bi_valid >= 8) {
|
||||
put_byte(s, s->bi_buf);
|
||||
s->bi_buf >>= 8;
|
||||
s->bi_valid -= 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user