From 0826ccc5ef4af3e0959d06ef169da1248b77e904 Mon Sep 17 00:00:00 2001 From: Timofey Solomko Date: Wed, 22 Nov 2017 00:06:39 +0300 Subject: [PATCH] Use smaller uint dwp functions where possible --- Sources/GZip/GzipArchive.swift | 2 +- Sources/GZip/GzipHeader.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/GZip/GzipArchive.swift b/Sources/GZip/GzipArchive.swift index a9b5d6a3..43adfa33 100644 --- a/Sources/GZip/GzipArchive.swift +++ b/Sources/GZip/GzipArchive.swift @@ -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, diff --git a/Sources/GZip/GzipHeader.swift b/Sources/GZip/GzipHeader.swift index 81b475d5..b35f27e6 100644 --- a/Sources/GZip/GzipHeader.swift +++ b/Sources/GZip/GzipHeader.swift @@ -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 } } }