Skip to content

Commit

Permalink
Let the compiler eliminate more code in LZS GET_BITS()
Browse files Browse the repository at this point in the history
It doesn't seem to make any noticeable performance difference but it's
less dead code. This code path *cannot* be hit in the bits < 9 case, so
let the compiler know.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Jan 8, 2015
1 parent 8bf8c63 commit eb79b63
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lzs.c
Expand Up @@ -41,10 +41,11 @@ do { \
if (bits > 8 || bits_left < 8) { \
/* We need bits from the next byte too... */ \
data |= src[0] >> bits_left; \
/* ...if we used *all* of them then bump the \
/* ...if we used *all* of them then (which can \
* only happen if bits > 8), then bump the \
* input pointer again so we never leave \
* bits_left == 0. */ \
if (!bits_left) { \
if (bits > 8 && !bits_left) { \
bits_left = 8; \
src++; \
srclen--; \
Expand Down

0 comments on commit eb79b63

Please sign in to comment.