blob: 88e3a41a22ca4022279b4e323e772338d8e8a2f5 [file] [log] [blame]
Austin Schuh272c6132020-11-14 16:37:52 -08001import Foundation
2
3public struct Struct {
4 public private(set) var bb: ByteBuffer
5 public private(set) var postion: Int32
6
7 public init(bb: ByteBuffer, position: Int32 = 0) {
8 self.bb = bb
9 self.postion = position
10 }
11
12 public func readBuffer<T: Scalar>(of type: T.Type, at o: Int32) -> T {
13 let r = bb.read(def: T.self, position: Int(o + postion))
14 return r
15 }
16}