igzip: Fix Type 0 block_size calculation missing buffered bits

Change-Id: I7ee01353673ca66e79e2087bf814bccf76d1824c
Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
Roy Oursler 2018-12-11 16:06:05 -07:00 committed by Greg Tucker
parent 2393791654
commit ff3841d638

View File

@ -382,9 +382,14 @@ static void create_icf_block_hdr(struct isal_zstream *stream, uint8_t * start_in
memcpy(&write_buf_tmp, write_buf, sizeof(struct BitBuf2));
/* Calculate the bytes required to store a type 0 block. Need to account
* for bits stored in the bitbuf. Since 3 bits correspond to the deflate
* type 0 header, we need to add one byte more when the number of bits
* is at least 6 mod 8. */
block_size = (TYPE0_BLK_HDR_LEN) * ((block_in_size + TYPE0_MAX_BLK_LEN - 1) /
TYPE0_MAX_BLK_LEN) + block_in_size;
block_size = block_size ? block_size : TYPE0_BLK_HDR_LEN;
block_size += (write_buf->m_bit_count + 2) / 8;
/* Write EOB in icf_buf */
level_buf->hist.ll_hist[256] = 1;