Rewrite BZip2.BlockSize.headerByte() as computed properties

This commit is contained in:
Timofey Solomko
2018-01-04 14:13:02 +03:00
parent ed01cd142f
commit b035d910a0
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ public extension BZip2 {
}
}
func headerByte() -> Int {
var headerByte: Int {
switch self {
case .one:
return 0x31
+1 -1
View File
@@ -44,7 +44,7 @@ extension BZip2: CompressionAlgorithm {
// BZip2 Header.
bitWriter.write(number: 0x425a, bitsCount: 16) // Magic number = 'BZ'.
bitWriter.write(number: 0x68, bitsCount: 8) // Version = 'h'.
bitWriter.write(number: blockSize.headerByte(), bitsCount: 8) // Block size.
bitWriter.write(number: blockSize.headerByte, bitsCount: 8) // Block size.
var totalCRC: UInt32 = 0
for i in stride(from: data.startIndex, to: data.endIndex, by: rawBlockSize) {