[lzw] Optimize last commit.

* src/lzw/ftzopen.c (ft_lzwstate_get_code): Move check into
conditional clause.
This commit is contained in:
Werner Lemberg 2016-08-16 13:44:38 +02:00
parent 6df68335f1
commit 8521ad99b0
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2016-08-16 Werner Lemberg <wl@gnu.org>
[lzw] Optimize last commit.
* src/lzw/ftzopen.c (ft_lzwstate_get_code): Move check into
conditional clause.
2016-08-16 Werner Lemberg <wl@gnu.org>
[lzw] Avoid invalid left shift.

View File

@ -65,16 +65,16 @@
FT_Int result;
if ( num_bits > LZW_MAX_BITS )
return -1;
if ( state->buf_clear ||
offset >= state->buf_size ||
state->free_ent >= state->free_bits )
{
if ( state->free_ent >= state->free_bits )
{
state->num_bits = ++num_bits;
state->num_bits = ++num_bits;
if ( num_bits > LZW_MAX_BITS )
return -1;
state->free_bits = state->num_bits < state->max_bits
? (FT_UInt)( ( 1UL << num_bits ) - 256 )
: state->max_free + 1;