summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2018-06-18 10:11:54 (GMT)
committer Michael Drake <michael.drake@codethink.co.uk>2018-06-18 10:13:57 (GMT)
commit7149b17577f04f3c34d6e1c938eeaf88c06b10ad (patch)
treefe2c69cd57d55ceeb0e62ecda14a2c86406a068c
parent50e568df2ca8252019460a7d43cb83efa600d02d (diff)
downloadlibnsgif-master.tar.gz
libnsgif-master.tar.bz2
LZW decoder: Tiny optimisation.HEADmaster
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.
-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) {