From 6c063cd522e9de60207b68a39f6602000e99e805 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Sat, 2 Oct 2021 18:23:26 +0300 Subject: [PATCH] [LZ4] Fix compilation issues on Swift 5.1-5.3 --- Sources/LZ4/LZ4+Compress.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/LZ4/LZ4+Compress.swift b/Sources/LZ4/LZ4+Compress.swift index 28530a8c..ff77d8d1 100644 --- a/Sources/LZ4/LZ4+Compress.swift +++ b/Sources/LZ4/LZ4+Compress.swift @@ -49,14 +49,14 @@ extension LZ4: CompressionAlgorithm { out.append(bd) if contentSize { - let size = UInt64(truncatingIfNeeded: data.count) + let size = data.count for i in 0..<8 { out.append(UInt8(truncatingIfNeeded: (size & (0xFF << (i * 8))) >> (i * 8))) } } if let dictionaryID = dictionaryID { - for i in 0..<4 { + for i: UInt32 in 0..<4 { out.append(UInt8(truncatingIfNeeded: (dictionaryID & (0xFF << (i * 8))) >> (i * 8))) } } @@ -82,7 +82,7 @@ extension LZ4: CompressionAlgorithm { fatalError("Patalogical size of non-compressible block.") } let blockSize = (0x80000000 as UInt32) | UInt32(truncatingIfNeeded: blockData.count) - for i in 0..<4 { + for i: UInt32 in 0..<4 { out.append(UInt8(truncatingIfNeeded: (blockSize & (0xFF << (i * 8))) >> (i * 8))) } out.append(contentsOf: blockData) @@ -93,7 +93,7 @@ extension LZ4: CompressionAlgorithm { fatalError("Patalogical size of compressed block.") } let blockSize = UInt32(truncatingIfNeeded: compressedBlock.count) - for i in 0..<4 { + for i:UInt32 in 0..<4 { out.append(UInt8(truncatingIfNeeded: (blockSize & (0xFF << (i * 8))) >> (i * 8))) } out.append(contentsOf: compressedBlock) @@ -101,7 +101,7 @@ extension LZ4: CompressionAlgorithm { if blockChecksums { let blockChecksum = XxHash32.hash(data: Data(compressedBlock)) - for i in 0..<4 { + for i: UInt32 in 0..<4 { out.append(UInt8(truncatingIfNeeded: (blockChecksum & (0xFF << (i * 8))) >> (i * 8))) } } @@ -113,7 +113,7 @@ extension LZ4: CompressionAlgorithm { // Content checksum. if contentChecksum { let hash = XxHash32.hash(data: data) - for i in 0..<4 { + for i: UInt32 in 0..<4 { out.append(UInt8(truncatingIfNeeded: (hash & (0xFF << (i * 8))) >> (i * 8))) } }