diff options
author | Nick Terrell <terrelln@fb.com> | 2019-07-30 22:21:52 (GMT) |
---|---|---|
committer | Nick Terrell <terrelln@fb.com> | 2019-07-31 17:16:25 (GMT) |
commit | 58ea585878008db36fa20025703757f0b70836eb (patch) | |
tree | f1bb54b31d652b7fcfccad1108012c1c17c86e57 | |
parent | 7e97bf377d3c3a6d0d71a3ce9116e1f0143a8740 (diff) | |
download | lz4-58ea585878008db36fa20025703757f0b70836eb.zip lz4-58ea585878008db36fa20025703757f0b70836eb.tar.gz lz4-58ea585878008db36fa20025703757f0b70836eb.tar.bz2 |
[lz4hc] Fix minor pessimization in extDict pattern matching
We should be comparing `matchPtr` not `ip`. This bug just means
that this branch was not taken, so we might miss some of the
forward length.
-rw-r--r-- | lib/lz4hc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index 4122af4..a0b8c48 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -335,7 +335,7 @@ LZ4HC_InsertAndGetWiderMatch ( const BYTE* const dictStart = dictBase + hc4->lowLimit; const BYTE* const iLimit = extDict ? dictBase + dictLimit : iHighLimit; size_t forwardPatternLength = LZ4HC_countPattern(matchPtr+sizeof(pattern), iLimit, pattern) + sizeof(pattern); - if (extDict && ip + forwardPatternLength == iLimit) { + if (extDict && matchPtr + forwardPatternLength == iLimit) { U32 const rotatedPattern = LZ4HC_rotatePattern(forwardPatternLength, pattern); forwardPatternLength += LZ4HC_countPattern(lowPrefixPtr, iHighLimit, rotatedPattern); } |