summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCyan4973 <cyan@fb.com>2018-04-23 22:47:08 (GMT)
committerCyan4973 <cyan@fb.com>2018-04-23 22:47:08 (GMT)
commitcd0663456f82b6d771e6aed01c6c4ff7f1bf4358 (patch)
treeef7aba51869224ba79e009895964be6c9472e69a /lib
parentbd06fde104c7c29b8d748dad8f27a08c328b74fe (diff)
downloadlz4-cd0663456f82b6d771e6aed01c6c4ff7f1bf4358.zip
lz4-cd0663456f82b6d771e6aed01c6c4ff7f1bf4358.tar.gz
lz4-cd0663456f82b6d771e6aed01c6c4ff7f1bf4358.tar.bz2
disable shortcut for LZ4_decompress_fast()
improving speed
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 40b2229..d794c35 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1536,9 +1536,10 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
* this shortcut was tested on x86 and x64, where it improves decoding speed.
* it has not yet been benchmarked on ARM, Power, mips, etc.
* NOTE: The loop begins with a read, so we must have one byte left at the end. */
- if (((ip + 14 /*maxLL*/ + 2 /*offset*/ < iend)
- & (op + 14 /*maxLL*/ + 18 /*maxML*/ <= oend))
- & ((token < (15<<ML_BITS)) & ((token & ML_MASK) != 15)) ) {
+ if (endOnInput
+ && ((ip + 14 /*maxLL*/ + 2 /*offset*/ < iend)
+ & (op + 14 /*maxLL*/ + 18 /*maxML*/ <= oend))
+ & ((token < (15<<ML_BITS)) & ((token & ML_MASK) != 15)) ) {
size_t const ll = token >> ML_BITS;
size_t const off = LZ4_readLE16(ip+ll);
const BYTE* const matchPtr = op + ll - off; /* pointer underflow risk ? */