mirror of
https://github.com/lz4/lz4.git
synced 2024-11-27 20:04:17 +08:00
fixed LZ4HC_reverseCountPattern()
for multi-bytes patterns (which is not useful for the time being)
This commit is contained in:
parent
897f5e9834
commit
b07d36245a
11
lib/lz4hc.c
11
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user