Skip to content

Add @_transparent to some more Integer operations #80712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions stdlib/public/core/Integers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2158,6 +2158,7 @@ where Magnitude: FixedWidthInteger & UnsignedInteger,

extension FixedWidthInteger {
@inlinable
@_transparent
public var bitWidth: Int { return Self.bitWidth }

@inlinable
Expand Down Expand Up @@ -2770,7 +2771,7 @@ extension FixedWidthInteger {
}

@inlinable // FIXME(inline-always)
@inline(__always)
@_transparent
public init<T: BinaryInteger>(truncatingIfNeeded source: T) {
if Self.bitWidth <= Int.bitWidth {
self = Self(_truncatingBits: source._lowWord)
Expand Down Expand Up @@ -3015,7 +3016,7 @@ extension UnsignedInteger {
/// This property is always `false` for unsigned integer types.
@inlinable // FIXME(inline-always)
public static var isSigned: Bool {
@inline(__always)
@_transparent
get { return false }
}
}
Expand Down Expand Up @@ -3228,7 +3229,7 @@ extension SignedInteger {
/// This property is always `true` for signed integer types.
@inlinable // FIXME(inline-always)
public static var isSigned: Bool {
@inline(__always)
@_transparent
get { return true }
}
}
Expand Down