Skip to content

Commit a0886be

Browse files
Inline parseInteger/parseUnsigned
1 parent fb3426d commit a0886be

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Sources/WasmParser/LEB.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
@usableFromInline
12
enum LEBError: Swift.Error, Equatable {
23
case overflow
34
case integerRepresentationTooLong
45
case insufficientBytes
56
}
67

7-
@inline(__always)
8+
@inlinable
89
func decodeLEB128<IntType, Stream>(
910
stream: Stream
1011
) throws -> IntType where IntType: FixedWidthInteger, IntType: UnsignedInteger, Stream: ByteStream {
@@ -32,6 +33,7 @@ func decodeLEB128<IntType, Stream>(
3233
return result
3334
}
3435

36+
@inlinable
3537
func decodeLEB128<IntType, Stream>(
3638
stream: Stream
3739
) throws -> IntType where IntType: FixedWidthInteger, IntType: RawSignedInteger, Stream: ByteStream {

Sources/WasmParser/WasmParser.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,12 @@ extension ByteStream {
322322
/// > Note:
323323
/// <https://webassembly.github.io/spec/core/binary/values.html#integers>
324324
extension ByteStream {
325-
@inline(__always)
326-
@usableFromInline
325+
@inlinable
327326
func parseUnsigned<T: RawUnsignedInteger>(_: T.Type = T.self) throws -> T {
328327
try decodeLEB128(stream: self)
329328
}
330329

331-
@usableFromInline
330+
@inlinable
332331
func parseSigned<T: FixedWidthInteger & RawSignedInteger>() throws -> T {
333332
try decodeLEB128(stream: self)
334333
}

0 commit comments

Comments
 (0)