mirror of
https://github.com/ninxsoft/Mist.git
synced 2025-05-30 23:15:18 -04:00
SwiftFormat spaceAroundOperators
This commit is contained in:
parent
32f1ff045a
commit
56598f9fa1
2 changed files with 5 additions and 5 deletions
|
@ -11,13 +11,13 @@ extension Array<UInt8> {
|
||||||
}
|
}
|
||||||
|
|
||||||
func uInt32(at offset: Int) -> UInt32 {
|
func uInt32(at offset: Int) -> UInt32 {
|
||||||
self[offset...offset + 0x03].reversed().reduce(0) {
|
self[offset ... offset + 0x03].reversed().reduce(0) {
|
||||||
$0 << 0x08 + UInt32($1)
|
$0 << 0x08 + UInt32($1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func uInt64(at offset: Int) -> UInt64 {
|
func uInt64(at offset: Int) -> UInt64 {
|
||||||
self[offset...offset + 0x07].reversed().reduce(0) {
|
self[offset ... offset + 0x07].reversed().reduce(0) {
|
||||||
$0 << 0x08 + UInt64($1)
|
$0 << 0x08 + UInt64($1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ struct Chunklist {
|
||||||
totalChunks = array.uInt64(at: 0x0C)
|
totalChunks = array.uInt64(at: 0x0C)
|
||||||
chunksOffset = array.uInt64(at: 0x14)
|
chunksOffset = array.uInt64(at: 0x14)
|
||||||
signatureOffset = array.uInt64(at: 0x1C)
|
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)...])
|
signature = Array(array[Int(signatureOffset)...])
|
||||||
|
|
||||||
guard magicHeader == Chunklist.magicHeader else {
|
guard magicHeader == Chunklist.magicHeader else {
|
||||||
|
@ -121,9 +121,9 @@ struct Chunklist {
|
||||||
private static func chunks(_ array: [UInt8], totalChunks: Int) -> [Chunk] {
|
private static func chunks(_ array: [UInt8], totalChunks: Int) -> [Chunk] {
|
||||||
var chunks: [Chunk] = []
|
var chunks: [Chunk] = []
|
||||||
|
|
||||||
for offset in 0..<totalChunks {
|
for offset in 0 ..< totalChunks {
|
||||||
let size: UInt32 = array.uInt32(at: offset * 0x24)
|
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)
|
let chunk: Chunk = .init(size: size, hash: hash)
|
||||||
chunks.append(chunk)
|
chunks.append(chunk)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue