From b07d36245a52048df233a90c382e523d4560fc64 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 7 Nov 2017 17:58:59 -0800 Subject: fixed LZ4HC_reverseCountPattern() for multi-bytes patterns (which is not useful for the time being) --- lib/lz4hc.c | 11 +++++------ 1 file 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); } -- cgit v0.12