summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-10-31 22:51:56 (GMT)
committerYann Collet <cyan@fb.com>2017-10-31 22:51:56 (GMT)
commita5731d6b266170f7bf0893c833af680d929f5616 (patch)
treef80d4c13f344d46d857a107cc1bd6ce4163d1075 /lib
parent9378f76e4186e7b4f33a79451b22afd5b6344c8d (diff)
downloadlz4-a5731d6b266170f7bf0893c833af680d929f5616.zip
lz4-a5731d6b266170f7bf0893c833af680d929f5616.tar.gz
lz4-a5731d6b266170f7bf0893c833af680d929f5616.tar.bz2
minor change, to help store forwarding
in a marginal case (offset==4)
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 1504790..5efcbc0 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1160,8 +1160,8 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
BYTE* oexit = op + targetOutputSize;
const BYTE* const dictEnd = (const BYTE*)dictStart + dictSize;
- const unsigned dec32table[] = {0, 1, 2, 1, 4, 4, 4, 4};
- const int dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3};
+ const unsigned inc32table[8] = {0, 1, 2, 1, 0, 4, 4, 4};
+ const int dec64table[8] = {0, 0, 0, -1, -4, 1, 2, 3};
const int safeDecode = (endOnInput==endOnInputSize);
const int checkOffset = ((safeDecode) && (dictSize < (int)(64 KB)));
@@ -1276,14 +1276,13 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
/* copy match within block */
cpy = op + length;
if (unlikely(offset<8)) {
- const int dec64 = dec64table[offset];
op[0] = match[0];
op[1] = match[1];
op[2] = match[2];
op[3] = match[3];
- match += dec32table[offset];
+ match += inc32table[offset];
memcpy(op+4, match, 4);
- match -= dec64;
+ match -= dec64table[offset];
} else { LZ4_copy8(op, match); match+=8; }
op += 8;
@@ -1300,7 +1299,7 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
LZ4_copy8(op, match);
if (length>16) LZ4_wildCopy(op+8, match+8, cpy);
}
- op=cpy; /* correction */
+ op = cpy; /* correction */
}
/* end of decoding */