File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -63,9 +63,11 @@ public struct BinaryReader {
63
63
let b = bytes ( count: 1 )
64
64
return b. first!
65
65
}
66
+ @inline ( __always)
66
67
public mutating func int8( ) -> Int8 {
67
68
return . init( bitPattern: uint8 ( ) )
68
69
}
70
+ @inline ( __always)
69
71
public mutating func bool( ) -> Bool {
70
72
return uint8 ( ) != 0
71
73
}
@@ -75,6 +77,7 @@ public struct BinaryReader {
75
77
let v = UInt16 ( b [ 0 ] ) | UInt16 ( b [ 1 ] ) << 8
76
78
return v
77
79
}
80
+ @inline ( __always)
78
81
public mutating func int16( ) -> Int16 {
79
82
return . init( bitPattern: uint16 ( ) )
80
83
}
@@ -83,6 +86,7 @@ public struct BinaryReader {
83
86
let b = endianConvert ( from: bytes ( count: 4 ) )
84
87
return UInt32 ( b [ 0 ] ) | UInt32 ( b [ 1 ] ) << 8 | UInt32 ( b [ 2 ] ) << 16 | UInt32 ( b [ 3 ] ) << 24
85
88
}
89
+ @inline ( __always)
86
90
public mutating func int32( ) -> Int32 {
87
91
return . init( bitPattern: uint32 ( ) )
88
92
}
@@ -93,14 +97,17 @@ public struct BinaryReader {
93
97
let upper : UInt64 = UInt64 ( b [ 4 ] ) << 32 | UInt64 ( b [ 5 ] ) << 40 | UInt64 ( b [ 6 ] ) << 48 | UInt64 ( b [ 7 ] ) << 56
94
98
return lower | upper
95
99
}
100
+ @inline ( __always)
96
101
public mutating func int64( ) -> Int64 {
97
102
return . init( bitPattern: uint64 ( ) )
98
103
}
99
104
105
+ @inline ( __always)
100
106
public mutating func float32( ) -> Float32 {
101
107
return . init( bitPattern: uint32 ( ) )
102
108
}
103
109
110
+ @inline ( __always)
104
111
public mutating func float64( ) -> Float64 {
105
112
return . init( bitPattern: uint64 ( ) )
106
113
}
You can’t perform that action at this time.
0 commit comments