diff --git a/Sources/LZ4/LZ4+Compress.swift b/Sources/LZ4/LZ4+Compress.swift index 52f1138f..f27e0515 100644 --- a/Sources/LZ4/LZ4+Compress.swift +++ b/Sources/LZ4/LZ4+Compress.swift @@ -161,17 +161,17 @@ extension LZ4: CompressionAlgorithm { // are checked for this condition in the match-searching while-loop, but minmatches (4-bytes long) are verified // here (hence -9). while i < blockBytes.endIndex - 9 { - let matchCrc = CheckSums.crc32(Data(blockBytes[i..) -> UInt32 { + var result = 0 as UInt32 + for i in range { + result <<= 8 + result |= UInt32(truncatingIfNeeded: bytes[i]) + } + return result + } + }