mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
Use smaller uint dwp functions where possible
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user