summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2018-04-16 22:11:28 (GMT)
committerYann Collet <cyan@fb.com>2018-04-16 22:11:28 (GMT)
commite9280647976ca468ab67ffbf3dd9c8e533fe23bf (patch)
tree31b291bc36536bbe095385873ee2aea67351fe6e /lib
parentd2bcfa31f525aaa11c2d248af0ba487791399c1f (diff)
downloadlz4-e9280647976ca468ab67ffbf3dd9c8e533fe23bf.zip
lz4-e9280647976ca468ab67ffbf3dd9c8e533fe23bf.tar.gz
lz4-e9280647976ca468ab67ffbf3dd9c8e533fe23bf.tar.bz2
fixed gcc performance regression
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index e8f9831..c2012f6 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -660,6 +660,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic(
/* Init conditions */
if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported inputSize, too large (or negative) */
if (tableType==byPtr) assert(dictDirective==noDict); /* only supported use case with byPtr */
+ assert(acceleration >= 1);
lowLimit = (const BYTE*)source - (dictDirective == withPrefix64k ? dictSize : 0);
@@ -712,6 +713,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic(
} else { /* byU32, byU16 */
const BYTE* forwardIp = ip;
+ unsigned step = 1;
unsigned searchMatchNb = acceleration << LZ4_skipTrigger;
do {
U32 const h = forwardH;
@@ -720,8 +722,8 @@ LZ4_FORCE_INLINE int LZ4_compress_generic(
assert(matchIndex <= current);
assert(forwardIp - base < (ptrdiff_t)(2 GB - 1));
ip = forwardIp;
- assert(searchMatchNb >= (1<<LZ4_skipTrigger));
- forwardIp += (searchMatchNb++ >> LZ4_skipTrigger);
+ forwardIp += step;
+ step = (searchMatchNb++ >> LZ4_skipTrigger);
if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals;
assert(ip < mflimitPlusOne);