 
 extension Int {
 
+    @inline(__always)
     func toUInt8() -> UInt8 {
         return UInt8(truncatingIfNeeded: UInt(self))
     }


extension UnsignedInteger {

    func toInt() -> Int {
        return Int(truncatingIfNeeded: self)
    }


extension Data {

    @inline(__always)
    func to<T>(type: T.Type) -> T {
        return self.withUnsafeBytes { $0.pointee }
    }

    @inline(__always)
    func toArray<T>(type: T.Type, count: Int) -> [T] {
        return self.withUnsafeBytes {
            [T](UnsafeBufferPointer(start: $0, count: count))
        }
    }

    @inline(__always)
    func toArray<T>(type: T.Type) -> [T] {
        return self.toArray(type: type, count: self.count / MemoryLayout<T>.size)
    }
