diff options
author | Yann Collet <cyan@fb.com> | 2017-11-08 01:58:59 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-11-08 01:58:59 (GMT) |
commit | b07d36245a52048df233a90c382e523d4560fc64 (patch) | |
tree | 6406fac186a8cc456f126b04646073b2b0ac9110 | |
parent | 897f5e9834ed4e8b4e34380b12a6b9e7b911af90 (diff) | |
download | lz4-b07d36245a52048df233a90c382e523d4560fc64.zip lz4-b07d36245a52048df233a90c382e523d4560fc64.tar.gz lz4-b07d36245a52048df233a90c382e523d4560fc64.tar.bz2 |
fixed LZ4HC_reverseCountPattern()
for multi-bytes patterns
(which is not useful for the time being)
-rw-r--r-- | lib/lz4hc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index 5e2dd2a..02eafaf 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -173,12 +173,11 @@ static unsigned LZ4HC_reverseCountPattern(const BYTE* ip, const BYTE* const iLow if (LZ4_read32(ip-4) != pattern) break; ip -= 4; } - while (likely(ip>iLow)) { - const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianess */ - if (ip[-1] != *bytePtr) break; - ip--; bytePtr--; - } - + { const BYTE* bytePtr = (const BYTE*)(&pattern) + 3; /* works for any endianess */ + while (likely(ip>iLow)) { + if (ip[-1] != *bytePtr) break; + ip--; bytePtr--; + } } return (unsigned)(iStart - ip); } |