Skip to content

Commit fc90619

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 fe98abb commit fc90619

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
}
@@ -3228,7 +3229,7 @@ extension SignedInteger {
32283229
/// This property is always `true` for signed integer types.
32293230
@inlinable // FIXME(inline-always)
32303231
public static var isSigned: Bool {
3231-
@inline(__always)
3232+
@_transparent
32323233
get { return true }
32333234
}
32343235
}

0 commit comments

Comments
 (0)