summaryrefslogtreecommitdiff
path: root/src/lzw.c
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2018-06-18 11:11:54 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2018-06-18 11:13:57 +0100
commit7149b17577f04f3c34d6e1c938eeaf88c06b10ad (patch)
treefe2c69cd57d55ceeb0e62ecda14a2c86406a068c /src/lzw.c
parent50e568df2ca8252019460a7d43cb83efa600d02d (diff)
downloadlibnsgif-7149b17577f04f3c34d6e1c938eeaf88c06b10ad.tar.gz
LZW decoder: Tiny optimisation.
When the next code fits exactly in what's left of the current sub-block, we can use the fast path. Spotted by Adrian Lees.
Diffstat (limited to 'src/lzw.c')
-rw-r--r--src/lzw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lzw.c b/src/lzw.c
index d65f77e..31cf7d4 100644
--- a/src/lzw.c
+++ b/src/lzw.c
@@ -163,7 +163,7 @@ static inline lzw_result lzw__next_code(
assert(byte_advance <= 2);
- if (ctx->sb_bit + code_size < ctx->sb_bit_count) {
+ if (ctx->sb_bit + code_size <= ctx->sb_bit_count) {
/* Fast path: code fully inside this sub-block */
const uint8_t *data = ctx->sb_data + (ctx->sb_bit >> 3);
switch (byte_advance) {