SwiftFormat spaceAroundOperators

This commit is contained in:
Nindi Gill 2023-11-19 19:41:12 +11:00
parent 32f1ff045a
commit 56598f9fa1
No known key found for this signature in database
GPG key ID: FF9A7FD590D4F4B1
2 changed files with 5 additions and 5 deletions

View file

@ -11,13 +11,13 @@ extension Array<UInt8> {
}
func uInt32(at offset: Int) -> UInt32 {
self[offset...offset + 0x03].reversed().reduce(0) {
self[offset ... offset + 0x03].reversed().reduce(0) {
$0 << 0x08 + UInt32($1)
}
}
func uInt64(at offset: Int) -> UInt64 {
self[offset...offset + 0x07].reversed().reduce(0) {
self[offset ... offset + 0x07].reversed().reduce(0) {
$0 << 0x08 + UInt64($1)
}
}

View file

@ -71,7 +71,7 @@ struct Chunklist {
totalChunks = array.uInt64(at: 0x0C)
chunksOffset = array.uInt64(at: 0x14)
signatureOffset = array.uInt64(at: 0x1C)
chunks = Chunklist.chunks(Array(array[Int(chunksOffset)..<Int(signatureOffset)]), totalChunks: Int(totalChunks))
chunks = Chunklist.chunks(Array(array[Int(chunksOffset) ..< Int(signatureOffset)]), totalChunks: Int(totalChunks))
signature = Array(array[Int(signatureOffset)...])
guard magicHeader == Chunklist.magicHeader else {
@ -121,9 +121,9 @@ struct Chunklist {
private static func chunks(_ array: [UInt8], totalChunks: Int) -> [Chunk] {
var chunks: [Chunk] = []
for offset in 0..<totalChunks {
for offset in 0 ..< totalChunks {
let size: UInt32 = array.uInt32(at: offset * 0x24)
let hash: [UInt8] = Array(array[offset * 0x24 + 0x04...(offset * 0x24 + 0x04) + 0x1F])
let hash: [UInt8] = Array(array[offset * 0x24 + 0x04 ... (offset * 0x24 + 0x04) + 0x1F])
let chunk: Chunk = .init(size: size, hash: hash)
chunks.append(chunk)
}