Skip to content

Commit

Permalink
compress: avoid undefined shift of WORDBITS bits
Browse files Browse the repository at this point in the history
  • Loading branch information
ebiggers committed May 17, 2016
1 parent 7aa8f11 commit 81baeff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/xpack_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,8 @@ symbol_ostream_add_bits(struct symbol_ostream *os, machine_word_t bits, unsigned
static forceinline void
symbol_ostream_flush_bits(struct symbol_ostream *os)
{
machine_word_t bits = os->bitbuf << (WORDBITS - os->bitcount);
machine_word_t bits = os->bitbuf <<
((WORDBITS - os->bitcount) & (WORDBITS - 1));

put_unaligned_leword(bits, os->next);
os->next -= MIN(os->next - os->begin, os->bitcount >> 3);
Expand Down

0 comments on commit 81baeff

Please sign in to comment.