mirror of
https://github.com/tsolomko/SWCompression.git
synced 2026-06-23 14:56:41 +00:00
Rewrite BZip2.BlockSize.headerByte() as computed properties
This commit is contained in:
@@ -55,7 +55,7 @@ public extension BZip2 {
|
||||
}
|
||||
}
|
||||
|
||||
func headerByte() -> Int {
|
||||
var headerByte: Int {
|
||||
switch self {
|
||||
case .one:
|
||||
return 0x31
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user