Use smaller uint dwp functions where possible

This commit is contained in:
Timofey Solomko
2017-11-22 00:06:39 +03:00
parent ea8a78045e
commit 0826ccc5ef
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -82,7 +82,7 @@ public class GzipArchive: Archive {
bitReader.align()
let crc32 = bitReader.uint32()
let isize = bitReader.uint64(count: 4)
let isize = bitReader.uint32()
guard UInt64(memberData.count) % (UInt64(1) << 32) == isize else { throw GzipError.wrongISize }
return Member(header: header, data: memberData,
+1 -1
View File
@@ -136,7 +136,7 @@ public struct GzipHeader {
// Some archives may contain 2-bytes checksum
if flags.contains(.fhcrc) {
// Note: it is not actual CRC-16, it is just two least significant bytes of CRC-32.
let crc16 = pointerData.uint32(count: 2)
let crc16 = pointerData.uint16()
guard CheckSums.crc32(headerBytes) & 0xFFFF == crc16 else { throw GzipError.wrongHeaderCRC }
}
}