mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Improve media index
This commit is contained in:
@@ -83,6 +83,15 @@ public struct ValueBoxKey: Equatable, Hashable, CustomStringConvertible, Compara
|
||||
memcpy(self.memory + offset, &varValue, 2)
|
||||
}
|
||||
|
||||
public func getData(_ offset: Int, length: Int) -> Data {
|
||||
assert(offset >= 0 && offset + length <= self.length)
|
||||
var value = Data(count: length)
|
||||
let _ = value.withUnsafeMutableBytes { bytes in
|
||||
memcpy(bytes.baseAddress!.assumingMemoryBound(to: UInt8.self), self.memory + offset, length)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
public func getInt32(_ offset: Int) -> Int32 {
|
||||
assert(offset >= 0 && offset + 4 <= self.length)
|
||||
var value: Int32 = 0
|
||||
|
||||
Reference in New Issue
Block a user