igzip: Modify sync_flush to not worry about writing eob

Change-Id: If3e7d5ff628574d715be348d96cdb82645985c25
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
Roy Oursler 2016-11-28 17:34:11 -07:00 committed by Greg Tucker
parent 4ec9df4f8a
commit 43d1029b81

View File

@ -106,19 +106,16 @@ void sync_flush(struct isal_zstream *stream)
{ {
struct isal_zstate *state = &stream->internal_state; struct isal_zstate *state = &stream->internal_state;
uint64_t bits_to_write = 0xFFFF0000, bits_len; uint64_t bits_to_write = 0xFFFF0000, bits_len;
uint64_t code = 0, len = 0, bytes; uint64_t bytes;
int flush_size; int flush_size;
if (stream->avail_out >= 8) { if (stream->avail_out >= 8) {
set_buf(&state->bitbuf, stream->next_out, stream->avail_out); set_buf(&state->bitbuf, stream->next_out, stream->avail_out);
if (!state->has_eob) flush_size = (-(state->bitbuf.m_bit_count + 3)) % 8;
get_lit_code(stream->hufftables, 256, &code, &len);
flush_size = (-(state->bitbuf.m_bit_count + len + 3)) % 8;
bits_to_write <<= flush_size + 3; bits_to_write <<= flush_size + 3;
bits_len = 32 + len + flush_size + 3; bits_len = 32 + flush_size + 3;
#ifdef USE_BITBUFB /* Write Bits Always */ #ifdef USE_BITBUFB /* Write Bits Always */
state->state = ZSTATE_NEW_HDR; state->state = ZSTATE_NEW_HDR;
@ -127,9 +124,6 @@ void sync_flush(struct isal_zstream *stream)
#endif #endif
state->has_eob = 0; state->has_eob = 0;
if (len > 0)
bits_to_write = (bits_to_write << len) | code;
write_bits(&state->bitbuf, bits_to_write, bits_len); write_bits(&state->bitbuf, bits_to_write, bits_len);
bytes = buffer_used(&state->bitbuf); bytes = buffer_used(&state->bitbuf);