Skip to content

Commit 856cbaf

Browse files
committed
Add @_transparent to some integer operations in the stdlib
@_transparent will ensure there are inlined in MandatoryInlining which runs before OSLogOptimization. OSLogOptimization does not look through their calls because they are not marked with @_semantics("constant_evaluable") which requires them to also be annotated as @_optimize(none) rdar://148256435
1 parent 7d77c61 commit 856cbaf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

stdlib/public/core/Integers.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2158,6 +2158,7 @@ where Magnitude: FixedWidthInteger & UnsignedInteger,
21582158

21592159
extension FixedWidthInteger {
21602160
@inlinable
2161+
@_transparent
21612162
public var bitWidth: Int { return Self.bitWidth }
21622163

21632164
@inlinable
@@ -2770,7 +2771,7 @@ extension FixedWidthInteger {
27702771
}
27712772

27722773
@inlinable // FIXME(inline-always)
2773-
@inline(__always)
2774+
@_transparent
27742775
public init<T: BinaryInteger>(truncatingIfNeeded source: T) {
27752776
if Self.bitWidth <= Int.bitWidth {
27762777
self = Self(_truncatingBits: source._lowWord)
@@ -3015,7 +3016,7 @@ extension UnsignedInteger {
30153016
/// This property is always `false` for unsigned integer types.
30163017
@inlinable // FIXME(inline-always)
30173018
public static var isSigned: Bool {
3018-
@inline(__always)
3019+
@_transparent
30193020
get { return false }
30203021
}
30213022
}
@@ -3230,7 +3231,7 @@ extension SignedInteger {
32303231
/// This property is always `true` for signed integer types.
32313232
@inlinable // FIXME(inline-always)
32323233
public static var isSigned: Bool {
3233-
@inline(__always)
3234+
@_transparent
32343235
get { return true }
32353236
}
32363237
}

0 commit comments

Comments
 (0)