Just to be absolutely in sync with GitHub. This is just a sketch.

Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
This commit is contained in:
Adam Rocska 2020-05-01 13:44:26 +02:00
parent d37ac6856c
commit b581f12b4f
1 changed files with 10 additions and 4 deletions

View File

@ -7,15 +7,21 @@ import Foundation
class Decoder { class Decoder {
private let pointerBaseByteSize: UInt private let data: Data
private var pointerBase: UInt private var pointerBase: UInt
private let pointerBaseByteSize: UInt
private lazy var switchByteOrder: Bool = { 0.littleEndian == 0 }() private lazy var switchByteOrder: Bool = { 0.littleEndian == 0 }()
init(pointerBase: UInt = 0) { init(data: Data, pointerBase: UInt = 0) {
precondition(log(Float(pointerBase)).truncatingRemainder(dividingBy: 8.0) == 0) precondition(log(Float(pointerBase)).truncatingRemainder(dividingBy: 8.0) == 0)
self.data = data
self.pointerBaseByteSize = UInt(log(Float(pointerBase)) / 8.0)
self.pointerBase = pointerBase self.pointerBase = pointerBase
self.pointerBaseByteSize = UInt(log(Float(pointerBase)) / 8.0)
}
func decode(from offset: Data.Index) {
let controlByte = data[offset]
let typeIdentifier = controlByte >> 5
} }
} }