SE-0425 implementation (#72139)

This commit is contained in:
Stephen Canon
2024-04-02 16:24:41 -04:00
committed by GitHub
parent c3b6a1a37c
commit a381589524
17 changed files with 2938 additions and 58 deletions

View File

@@ -2,7 +2,7 @@
//
// This source file is part of the Swift Atomics open source project
//
// Copyright (c) 2023 Apple Inc. and the Swift project authors
// Copyright (c) 2023-2024 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
@@ -14,15 +14,19 @@ import Builtin
% from SwiftAtomics import *
% for (intType, intStorage, builtinInt) in intTypes:
% for U in ["", "U"]:
% for bits in atomicBits:
% intType = U + "Int" + bits
% intStorage = "_Atomic" + bits + "BitStorage"
//===----------------------------------------------------------------------===//
// ${intType} AtomicRepresentable conformance
//===----------------------------------------------------------------------===//
% if intType == "Int64" or intType == "UInt64":
#if (_pointerBitWidth(_32) && _hasAtomicBitWidth(_64)) || _pointerBitWidth(_64)
% end
% if bits != "":
% # Assume that everyone has word-sized atomics, but check for the rest
#if _hasAtomicBitWidth(_${bits})
% end
@available(SwiftStdlib 6.0, *)
extension ${intType}: AtomicRepresentable {
@@ -107,7 +111,7 @@ extension Atomic where Value == ${intType} {
@_alwaysEmitIntoClient
@_transparent
public func ${lowerFirst(name)}(
_ operand: ${intType}${" = 1" if "crement" in name else ""},
_ operand: ${intType},
ordering: AtomicUpdateOrdering
) -> (oldValue: ${intType}, newValue: ${intType}) {
let original = switch ordering {
@@ -128,7 +132,7 @@ extension Atomic where Value == ${intType} {
#error("Unsupported platform")
#endif
% else:
Builtin.atomicrmw_${atomicOperationName(intType, builtinName)}_${llvmOrder}_${builtinInt}(
Builtin.atomicrmw_${atomicOperationName(intType, builtinName)}_${llvmOrder}_Int${bits}(
rawAddress,
operand._value
)
@@ -231,8 +235,9 @@ extension Atomic where Value == ${intType} {
}
}
% if intType == "Int64" or intType == "UInt64":
#endif
% end
% if bits != "":
#endif // _hasAtomicBitWidth
% end
% end
% end

View File

@@ -226,11 +226,13 @@ split_embedded_sources(
EMBEDDED DurationProtocol.swift
EMBEDDED FloatingPointRandom.swift
EMBEDDED Instant.swift
EMBEDDED Int128.swift
NORMAL Mirror.swift
NORMAL PlaygroundDisplay.swift
NORMAL CommandLine.swift
EMBEDDED SliceBuffer.swift
NORMAL StaticBigInt.swift
EMBEDDED UInt128.swift
NORMAL UnfoldSequence.swift
NORMAL UnsafeBufferPointerSlice.swift
NORMAL VarArgs.swift
@@ -246,9 +248,9 @@ split_embedded_sources(
NORMAL FloatingPointParsing.swift.gyb
EMBEDDED FloatingPointTypes.swift.gyb
EMBEDDED IntegerTypes.swift.gyb
EMBEDDED LegacyInt128.swift.gyb
EMBEDDED UnsafeBufferPointer.swift.gyb
EMBEDDED UnsafeRawBufferPointer.swift.gyb
EMBEDDED Int128.swift.gyb
EMBEDDED Tuple.swift.gyb
)

File diff suppressed because it is too large Load Diff

View File

@@ -169,10 +169,13 @@
"BuiltinMath.swift",
{
"Integers": [
"Int128.swift",
"Integers.swift",
"IntegerTypes.swift",
"IntegerParsing.swift",
"StaticBigInt.swift"],
"LegacyInt128.swift",
"StaticBigInt.swift",
"UInt128.swift"],
"Floating": [
"FloatingPoint.swift",
"FloatingPointParsing.swift",
@@ -244,7 +247,6 @@
"LegacyABI.swift",
"MigrationSupport.swift",
"PtrAuth.swift",
"Int128.swift",
"Duration.swift",
"DurationProtocol.swift",
"Instant.swift",

View File

@@ -0,0 +1,397 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2024 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
// MARK: - Memory layout
/// A 128-bit signed integer type.
@available(SwiftStdlib 6.0, *)
@frozen
public struct Int128: Sendable {
// On 64-bit platforms (including arm64_32 and any similar targets with
// 32b pointers but HW-backed 64b integers), the layout is simply that
// of `Builtin.Int128`.
#if _pointerBitWidth(_64) || arch(arm64_32)
public var _value: Builtin.Int128
@_transparent
public init(_ _value: Builtin.Int128) {
self._value = _value
}
@usableFromInline @_transparent
internal var _low: UInt64 {
UInt64(truncatingIfNeeded: self)
}
@usableFromInline @_transparent
internal var _high: Int64 {
Int64(truncatingIfNeeded: self &>> 64)
}
@usableFromInline @_transparent
internal init(_low: UInt64, _high: Int64) {
#if _endian(little)
self = unsafeBitCast((_low, _high), to: Int128.self)
#else
self = unsafeBitCast((_high, _low), to: Int128.self)
#endif
}
#else
// On 32-bit platforms, we don't want to use Builtin.Int128 for layout
// because it would be 16B aligned, which is excessive for such targets
// (and generally incompatible with C's `_BitInt(128)`). Instead we lay
// out the type as two `UInt64` fields--note that we have to be careful
// about endianness in this case.
#if _endian(little)
@usableFromInline internal var _low: UInt64
@usableFromInline internal var _high: Int64
#else
@usableFromInline internal var _high: Int64
@usableFromInline internal var _low: UInt64
#endif
@usableFromInline @_transparent
internal init(_low: UInt64, _high: Int64) {
self._low = _low
self._high = _high
}
public var _value: Builtin.Int128 {
@_transparent get { unsafeBitCast(self, to: Builtin.Int128.self) }
@_transparent set { self = Self(newValue) }
}
@_transparent
public init(_ _value: Builtin.Int128) {
self = unsafeBitCast(_value, to: Self.self)
}
#endif
@_transparent
public init(bitPattern: UInt128) {
self.init(bitPattern._value)
}
}
// MARK: - Constants
@available(SwiftStdlib 6.0, *)
extension Int128 {
@_transparent
public static var zero: Self {
Self(Builtin.zeroInitializer())
}
@_transparent
public static var min: Self {
Self(_low: .zero, _high: .min)
}
@_transparent
public static var max: Self {
Self(_low: .max, _high: .max)
}
}
// MARK: - Conversions from other integers
@available(SwiftStdlib 6.0, *)
extension Int128: ExpressibleByIntegerLiteral,
_ExpressibleByBuiltinIntegerLiteral {
public typealias IntegerLiteralType = Self
@_transparent
public init(_builtinIntegerLiteral x: Builtin.IntLiteral) {
self.init(Builtin.s_to_s_checked_trunc_IntLiteral_Int128(x).0)
}
@inlinable
public init?<T>(exactly source: T) where T: BinaryInteger {
guard let high = Int64(exactly: source >> 64) else { return nil }
let low = UInt64(truncatingIfNeeded: source)
self.init(_low: low, _high: high)
}
@inlinable
public init<T>(_ source: T) where T: BinaryInteger {
guard let value = Self(exactly: source) else {
fatalError("value cannot be converted to Int128 because it is outside the representable range")
}
self = value
}
@inlinable
public init<T>(clamping source: T) where T: BinaryInteger {
guard let value = Self(exactly: source) else {
self = source < .zero ? .min : .max
return
}
self = value
}
@inlinable
public init<T>(truncatingIfNeeded source: T) where T: BinaryInteger {
let high = Int64(truncatingIfNeeded: source >> 64)
let low = UInt64(truncatingIfNeeded: source)
self.init(_low: low, _high: high)
}
@inlinable
public init(_truncatingBits source: UInt) {
self.init(_low: UInt64(source), _high: .zero)
}
}
// MARK: - Conversions from Binary floating-point
@available(SwiftStdlib 6.0, *)
extension Int128 {
@inlinable
public init?<T>(exactly source: T) where T: BinaryFloatingPoint {
if source.magnitude < 0x1.0p64 {
guard let magnitude = UInt64(exactly: source.magnitude) else {
return nil
}
self = Int128(_low: magnitude, _high: 0)
if source < 0 { self = -self }
} else {
let highAsFloat = (source * 0x1.0p-64).rounded(.down)
guard let high = Int64(exactly: highAsFloat) else { return nil }
// Because we already ruled out |source| < 0x1.0p64, we know that
// high contains at least one value bit, and so Sterbenz' lemma
// allows us to compute an exact residual:
guard let low = UInt64(exactly: source - 0x1.0p64*highAsFloat) else {
return nil
}
self.init(_low: low, _high: high)
}
}
@inlinable
public init<T>(_ source: T) where T: BinaryFloatingPoint {
guard let value = Self(exactly: source.rounded(.towardZero)) else {
fatalError("value cannot be converted to Int128 because it is outside the representable range")
}
self = value
}
}
// MARK: - Non-arithmetic utility conformances
@available(SwiftStdlib 6.0, *)
extension Int128: Equatable {
@inlinable
public static func ==(a: Self, b: Self) -> Bool {
Bool(Builtin.cmp_eq_Int128(a._value, b._value))
}
}
@available(SwiftStdlib 6.0, *)
extension Int128: Comparable {
@inlinable
public static func <(a: Self, b: Self) -> Bool {
Bool(Builtin.cmp_slt_Int128(a._value, b._value))
}
}
@available(SwiftStdlib 6.0, *)
extension Int128: Hashable {
@inlinable
public func hash(into hasher: inout Hasher) {
hasher.combine(_low)
hasher.combine(_high)
}
}
// MARK: - Overflow-reporting arithmetic
@available(SwiftStdlib 6.0, *)
extension Int128 {
@_transparent
public func addingReportingOverflow(
_ other: Self
) -> (partialValue: Self, overflow: Bool) {
let (result, overflow) = Builtin.sadd_with_overflow_Int128(
self._value, other._value, Builtin.zeroInitializer()
)
return (Self(result), Bool(overflow))
}
@_transparent
public func subtractingReportingOverflow(
_ other: Self
) -> (partialValue: Self, overflow: Bool) {
let (result, overflow) = Builtin.ssub_with_overflow_Int128(
self._value, other._value, Builtin.zeroInitializer()
)
return (Self(result), Bool(overflow))
}
@inline(__always)
public func multipliedReportingOverflow(
by other: Self
) -> (partialValue: Self, overflow: Bool) {
let a = self.magnitude
let b = other.magnitude
let (magnitude, overflow) = a.multipliedReportingOverflow(by: b)
if (self < 0) != (other < 0) {
let partialValue = Self(bitPattern: 0 &- magnitude)
return (partialValue, overflow || partialValue > 0)
} else {
let partialValue = Self(bitPattern: magnitude)
return (partialValue, overflow || partialValue < 0)
}
}
@inline(__always)
public func dividedReportingOverflow(
by other: Self
) -> (partialValue: Self, overflow: Bool) {
precondition(other != .zero, "Division by zero")
if self == .min && other == -1 { return (.min, true) }
return (Self(Builtin.sdiv_Int128(self._value, other._value)), false)
}
@inline(__always)
public func remainderReportingOverflow(
dividingBy other: Self
) -> (partialValue: Self, overflow: Bool) {
precondition(other != .zero, "Remainder dividing by zero.")
if self == .min && other == -1 { return (0, true) }
return (Self(Builtin.srem_Int128(self._value, other._value)), false)
}
}
// MARK: - AdditiveArithmetic conformance
@available(SwiftStdlib 6.0, *)
extension Int128: AdditiveArithmetic {
@inlinable
public static func +(a: Self, b: Self) -> Self {
let (result, overflow) = a.addingReportingOverflow(b)
// On arm64, this check materializes the carryout in register, then does
// a TBNZ, where we should get a b.cs instead. I filed rdar://115387277
// to track this, but it only costs us one extra instruction, so we'll
// keep it as is for now.
precondition(!overflow)
return result
}
@inlinable
public static func -(a: Self, b: Self) -> Self {
let (result, overflow) = a.subtractingReportingOverflow(b)
precondition(!overflow)
return result
}
}
// MARK: - Multiplication and division
@available(SwiftStdlib 6.0, *)
extension Int128 {
public static func *(a: Self, b: Self) -> Self {
let (result, overflow) = a.multipliedReportingOverflow(by: b)
precondition(!overflow)
return result
}
@inlinable
public static func *=(a: inout Self, b: Self) { a = a * b }
public static func /(a: Self, b: Self) -> Self {
return a.dividedReportingOverflow(by: b).partialValue
}
@inlinable
public static func /=(a: inout Self, b: Self) { a = a / b }
public static func %(a: Self, b: Self) -> Self {
return a.remainderReportingOverflow(dividingBy: b).partialValue
}
@inlinable
public static func %=(a: inout Self, b: Self) { a = a % b }
}
// MARK: - Numeric conformance
@available(SwiftStdlib 6.0, *)
extension Int128: SignedNumeric {
public typealias Magnitude = UInt128
@inlinable
public var magnitude: Magnitude {
let unsignedSelf = UInt128(_value)
return self < 0 ? 0 &- unsignedSelf : unsignedSelf
}
}
// MARK: - BinaryInteger conformance
@available(SwiftStdlib 6.0, *)
extension Int128: BinaryInteger {
@inlinable
public var words: UInt128.Words {
Words(_value: UInt128(_value))
}
public static func &=(a: inout Self, b: Self) {
a._value = Builtin.and_Int128(a._value, b._value)
}
public static func |=(a: inout Self, b: Self) {
a._value = Builtin.or_Int128(a._value, b._value)
}
public static func ^=(a: inout Self, b: Self) {
a._value = Builtin.xor_Int128(a._value, b._value)
}
public static func &>>=(a: inout Self, b: Self) {
let masked = b & 127
a._value = Builtin.ashr_Int128(a._value, masked._value)
}
public static func &<<=(a: inout Self, b: Self) {
let masked = b & 127
a._value = Builtin.shl_Int128(a._value, masked._value)
}
public var trailingZeroBitCount: Int {
_low == 0 ? 64 + _high.trailingZeroBitCount : _low.trailingZeroBitCount
}
}
// MARK: - FixedWidthInteger conformance
@available(SwiftStdlib 6.0, *)
extension Int128: FixedWidthInteger, SignedInteger {
@_transparent
static public var bitWidth: Int { 128 }
public var nonzeroBitCount: Int {
_high.nonzeroBitCount &+ _low.nonzeroBitCount
}
public var leadingZeroBitCount: Int {
_high == 0 ? 64 + _low.leadingZeroBitCount : _high.leadingZeroBitCount
}
public var byteSwapped: Self {
return Self(_low: UInt64(bitPattern: _high.byteSwapped),
_high: Int64(bitPattern: _low.byteSwapped))
}
@_transparent
public static func &*(lhs: Self, rhs: Self) -> Self {
// The default &* on FixedWidthInteger calls multipliedReportingOverflow,
// which we want to avoid here, since the overflow check is expensive
// enough that we wouldn't want to inline it into most callers.
Self(Builtin.mul_Int128(lhs._value, rhs._value))
}
}

View File

@@ -2251,6 +2251,32 @@ where Magnitude: FixedWidthInteger & UnsignedInteger,
/// outside the range `0..<lhs.bitWidth`, it is masked to produce a
/// value within that range.
static func &<<=(lhs: inout Self, rhs: Self)
/// Returns the product of the two given values, wrapping the result in case
/// of any overflow.
///
/// The overflow multiplication operator (`&*`) discards any bits that
/// overflow the fixed width of the integer type. In the following example,
/// the product of `10` and `50` is greater than the maximum representable
/// `Int8` value, so the result is the partial value after discarding the
/// overflowing bits.
///
/// let x: Int8 = 10 &* 5
/// // x == 50
/// let y: Int8 = 10 &* 50
/// // y == -12 (after overflow)
///
/// For more about arithmetic with overflow operators, see [Overflow
/// Operators][overflow] in *[The Swift Programming Language][tspl]*.
///
/// [overflow]: https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID37
/// [tspl]: https://docs.swift.org/swift-book/
///
/// - Parameters:
/// - lhs: The first value to multiply.
/// - rhs: The second value to multiply.
@available(SwiftStdlib 6.0, *)
static func &*(lhs: Self, rhs: Self) -> Self
}
extension FixedWidthInteger {
@@ -3295,32 +3321,9 @@ extension FixedWidthInteger {
lhs = lhs &- rhs
}
/// Returns the product of the two given values, wrapping the result in case
/// of any overflow.
///
/// The overflow multiplication operator (`&*`) discards any bits that
/// overflow the fixed width of the integer type. In the following example,
/// the product of `10` and `50` is greater than the maximum representable
/// `Int8` value, so the result is the partial value after discarding the
/// overflowing bits.
///
/// let x: Int8 = 10 &* 5
/// // x == 50
/// let y: Int8 = 10 &* 50
/// // y == -12 (after overflow)
///
/// For more about arithmetic with overflow operators, see [Overflow
/// Operators][overflow] in *[The Swift Programming Language][tspl]*.
///
/// [overflow]: https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID37
/// [tspl]: https://docs.swift.org/swift-book/
///
/// - Parameters:
/// - lhs: The first value to multiply.
/// - rhs: The second value to multiply.
@_transparent
public static func &* (lhs: Self, rhs: Self) -> Self {
return lhs.multipliedReportingOverflow(by: rhs).partialValue
public static func &*(lhs: Self, rhs: Self) -> Self {
return rhs.multipliedReportingOverflow(by: lhs).partialValue
}
/// Multiplies two values and stores the result in the left-hand-side

View File

@@ -261,4 +261,20 @@ extension Float80: CustomReflectable {
}
#endif
@available(SwiftStdlib 6.0, *)
extension UInt128: CustomReflectable {
/// A mirror that reflects the `UInt128` instance.
public var customMirror: Mirror {
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
}
}
@available(SwiftStdlib 6.0, *)
extension Int128: CustomReflectable {
/// A mirror that reflects the `Int128` instance.
public var customMirror: Mirror {
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
}
}
#endif

View File

@@ -0,0 +1,413 @@
//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2024 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
// MARK: - Memory layout
/// A 128-bit unsigned integer type.
@available(SwiftStdlib 6.0, *)
@frozen
public struct UInt128: Sendable {
#if _pointerBitWidth(_64) || arch(arm64_32)
// On 64-bit platforms (including arm64_32 and any similar targets with
// 32b pointers but HW-backed 64b integers), the layout is simply that
// of `Builtin.Int128`.
public var _value: Builtin.Int128
@_transparent
public init(_ _value: Builtin.Int128) {
self._value = _value
}
@usableFromInline @_transparent
internal var _low: UInt64 {
UInt64(truncatingIfNeeded: self)
}
@usableFromInline @_transparent
internal var _high: UInt64 {
UInt64(truncatingIfNeeded: self &>> 64)
}
@usableFromInline @_transparent
internal init(_low: UInt64, _high: UInt64) {
#if _endian(little)
self = unsafeBitCast((_low, _high), to: Self.self)
#else
self = unsafeBitCast((_high, _low), to: Self.self)
#endif
}
#else
// On 32-bit platforms, we don't want to use Builtin.Int128 for layout
// because it would be 16B aligned, which is excessive for such targets
// (and generally incompatible with C's `_BitInt(128)`). Instead we lay
// out the type as two `UInt64` fields--note that we have to be careful
// about endianness in this case.
#if _endian(little)
@usableFromInline internal var _low: UInt64
@usableFromInline internal var _high: UInt64
#else
@usableFromInline internal var _high: UInt64
@usableFromInline internal var _low: UInt64
#endif
@usableFromInline @_transparent
internal init(_low: UInt64, _high: UInt64) {
self._low = _low
self._high = _high
}
public var _value: Builtin.Int128 {
@_transparent get { unsafeBitCast(self, to: Builtin.Int128.self) }
@_transparent set { self = Self(newValue) }
}
@_transparent
public init(_ _value: Builtin.Int128) {
self = unsafeBitCast(_value, to: Self.self)
}
#endif
@_transparent
public init(bitPattern: Int128) {
self.init(bitPattern._value)
}
}
// MARK: - Constants
@available(SwiftStdlib 6.0, *)
extension UInt128 {
@inlinable
public static var zero: Self {
Self(Builtin.zeroInitializer())
}
@inlinable
public static var min: Self { zero }
@inlinable
public static var max: Self {
Self(_low: .max, _high: .max)
}
}
// MARK: - Conversions from other integers
@available(SwiftStdlib 6.0, *)
extension UInt128: ExpressibleByIntegerLiteral,
_ExpressibleByBuiltinIntegerLiteral {
public typealias IntegerLiteralType = Self
@inlinable
public init(_builtinIntegerLiteral x: Builtin.IntLiteral) {
self.init(Builtin.s_to_u_checked_trunc_IntLiteral_Int128(x).0)
}
@inlinable
public init?<T>(exactly source: T) where T: BinaryInteger {
guard let high = UInt64(exactly: source >> 64) else { return nil }
let low = UInt64(truncatingIfNeeded: source)
self.init(_low: low, _high: high)
}
@inlinable
public init<T>(_ source: T) where T: BinaryInteger {
guard let value = Self(exactly: source) else {
fatalError("value cannot be converted to UInt128 because it is outside the representable range")
}
self = value
}
@inlinable
public init<T>(clamping source: T) where T: BinaryInteger {
guard let value = Self(exactly: source) else {
self = source < .zero ? .zero : .max
return
}
self = value
}
@inlinable
public init<T>(truncatingIfNeeded source: T) where T: BinaryInteger {
let high = UInt64(truncatingIfNeeded: source >> 64)
let low = UInt64(truncatingIfNeeded: source)
self.init(_low: low, _high: high)
}
@inlinable
public init(_truncatingBits source: UInt) {
self.init(_low: UInt64(source), _high: .zero)
}
}
// MARK: - Conversions from Binary floating-point
@available(SwiftStdlib 6.0, *)
extension UInt128 {
@inlinable
public init?<T>(exactly source: T) where T: BinaryFloatingPoint {
let highAsFloat = (source * 0x1.0p-64).rounded(.towardZero)
guard let high = UInt64(exactly: highAsFloat) else { return nil }
guard let low = UInt64(
exactly: high == 0 ? source : source - 0x1.0p64*highAsFloat
) else { return nil }
self.init(_low: low, _high: high)
}
@inlinable
public init<T>(_ source: T) where T: BinaryFloatingPoint {
guard let value = Self(exactly: source.rounded(.towardZero)) else {
fatalError("value cannot be converted to UInt128 because it is outside the representable range")
}
self = value
}
}
// MARK: - Non-arithmetic utility conformances
@available(SwiftStdlib 6.0, *)
extension UInt128: Equatable {
@inlinable
public static func ==(a: Self, b: Self) -> Bool {
Bool(Builtin.cmp_eq_Int128(a._value, b._value))
}
}
@available(SwiftStdlib 6.0, *)
extension UInt128: Comparable {
@inlinable
public static func <(a: Self, b: Self) -> Bool {
Bool(Builtin.cmp_ult_Int128(a._value, b._value))
}
}
@available(SwiftStdlib 6.0, *)
extension UInt128: Hashable {
@inlinable
public func hash(into hasher: inout Hasher) {
hasher.combine(_low)
hasher.combine(_high)
}
}
// MARK: - Overflow-reporting arithmetic
@available(SwiftStdlib 6.0, *)
extension UInt128 {
@inlinable
public func addingReportingOverflow(
_ other: Self
) -> (partialValue: Self, overflow: Bool) {
let (result, overflow) = Builtin.uadd_with_overflow_Int128(
self._value, other._value, Builtin.zeroInitializer()
)
return (Self(result), Bool(overflow))
}
@inlinable
public func subtractingReportingOverflow(
_ other: Self
) -> (partialValue: Self, overflow: Bool) {
let (result, overflow) = Builtin.usub_with_overflow_Int128(
self._value, other._value, Builtin.zeroInitializer()
)
return (Self(result), Bool(overflow))
}
@inlinable
public func multipliedReportingOverflow(
by other: Self
) -> (partialValue: Self, overflow: Bool) {
let (result, overflow) = Builtin.umul_with_overflow_Int128(
self._value, other._value, Builtin.zeroInitializer()
)
return (Self(result), Bool(overflow))
}
@inlinable
public func dividedReportingOverflow(
by other: Self
) -> (partialValue: Self, overflow: Bool) {
precondition(other != .zero, "Division by zero.")
// Unsigned divide never overflows.
return (Self(Builtin.udiv_Int128(self._value, other._value)), false)
}
@inlinable
public func remainderReportingOverflow(
dividingBy other: Self
) -> (partialValue: Self, overflow: Bool) {
precondition(other != .zero, "Remainder dividing by zero.")
// Unsigned divide never overflows.
return (Self(Builtin.urem_Int128(self._value, other._value)), false)
}
}
// MARK: - AdditiveArithmetic conformance
@available(SwiftStdlib 6.0, *)
extension UInt128: AdditiveArithmetic {
@inlinable
public static func +(a: Self, b: Self) -> Self {
let (result, overflow) = a.addingReportingOverflow(b)
// On arm64, this check materializes the carryout in register, then does
// a TBNZ, where we should get a b.cs instead. I filed rdar://115387277
// to track this, but it only costs us one extra instruction, so we'll
// keep it as is for now.
precondition(!overflow)
return result
}
@inlinable
public static func -(a: Self, b: Self) -> Self {
let (result, overflow) = a.subtractingReportingOverflow(b)
precondition(!overflow)
return result
}
}
// MARK: - Multiplication and division
@available(SwiftStdlib 6.0, *)
extension UInt128 {
@inlinable
public static func *(a: Self, b: Self) -> Self {
let (result, overflow) = a.multipliedReportingOverflow(by: b)
precondition(!overflow)
return result
}
@inlinable
public static func *=(a: inout Self, b: Self) { a = a * b }
@inlinable
public static func /(a: Self, b: Self) -> Self {
return a.dividedReportingOverflow(by: b).partialValue
}
@inlinable
public static func /=(a: inout Self, b: Self) { a = a / b }
@inlinable
public static func %(a: Self, b: Self) -> Self {
return a.remainderReportingOverflow(dividingBy: b).partialValue
}
@inlinable
public static func %=(a: inout Self, b: Self) { a = a % b }
}
// MARK: - Numeric conformance
@available(SwiftStdlib 6.0, *)
extension UInt128: Numeric {
public typealias Magnitude = Self
@inlinable
public var magnitude: Self { self }
}
// MARK: - BinaryInteger conformance
@available(SwiftStdlib 6.0, *)
extension UInt128: BinaryInteger {
public struct Words {
@usableFromInline
let _value: UInt128
@usableFromInline
init(_value: UInt128) { self._value = _value }
}
@inlinable
public var words: Words { Words(_value: self) }
@inlinable
public static func &=(a: inout Self, b: Self) {
a._value = Builtin.and_Int128(a._value, b._value)
}
@inlinable
public static func |=(a: inout Self, b: Self) {
a._value = Builtin.or_Int128(a._value, b._value)
}
@inlinable
public static func ^=(a: inout Self, b: Self) {
a._value = Builtin.xor_Int128(a._value, b._value)
}
@inlinable
public static func &>>=(a: inout Self, b: Self) {
let masked = b & 127
a._value = Builtin.lshr_Int128(a._value, masked._value)
}
@inlinable
public static func &<<=(a: inout Self, b: Self) {
let masked = b & 127
a._value = Builtin.shl_Int128(a._value, masked._value)
}
@inlinable
public var trailingZeroBitCount: Int {
_low == 0 ? 64 + _high.trailingZeroBitCount : _low.trailingZeroBitCount
}
}
@available(SwiftStdlib 6.0, *)
extension UInt128.Words: RandomAccessCollection {
public typealias Element = UInt
public typealias Index = Int
public typealias SubSequence = Slice<Self>
public typealias Indices = Range<Int>
@inlinable public var count: Int { 128 / UInt.bitWidth }
@inlinable public var startIndex: Int { 0 }
@inlinable public var endIndex: Int { count }
@inlinable public var indices: Indices { startIndex ..< endIndex }
@inlinable public func index(after i: Int) -> Int { i + 1 }
@inlinable public func index(before i: Int) -> Int { i - 1 }
public subscript(position: Int) -> UInt {
@inlinable
get {
precondition(position >= 0 && position < count)
var value = _value
#if _endian(little)
let index = position
#else
let index = count - 1 - position
#endif
return _withUnprotectedUnsafePointer(to: &value) {
$0.withMemoryRebound(to: UInt.self, capacity: count) { $0[index] }
}
}
}
}
// MARK: - FixedWidthInteger conformance
@available(SwiftStdlib 6.0, *)
extension UInt128: FixedWidthInteger, UnsignedInteger {
@inlinable
static public var bitWidth: Int { 128 }
@inlinable
public var nonzeroBitCount: Int {
_high.nonzeroBitCount &+ _low.nonzeroBitCount
}
@inlinable
public var leadingZeroBitCount: Int {
_high == 0 ? 64 + _low.leadingZeroBitCount : _high.leadingZeroBitCount
}
@inlinable
public var byteSwapped: Self {
return Self(_low: _high.byteSwapped, _high: _low.byteSwapped)
}
}

View File

@@ -245,6 +245,309 @@ Added: _$sSR7isEmptySbvpMV
// property descriptor for Swift.UnsafeMutableBufferPointer.isEmpty : Swift.Bool
Added: _$sSr7isEmptySbvpMV
// Int128
Added: _$sSYsSERzs6Int128V8RawValueSYRtzrlE6encode2toys7Encoder_p_tKF
Added: _$sSYsSERzs7UInt128V8RawValueSYRtzrlE6encode2toys7Encoder_p_tKF
Added: _$sSYsSeRzs6Int128V8RawValueSYRtzrlE4fromxs7Decoder_p_tKcfC
Added: _$ss22KeyedDecodingContainerV15decodeIfPresent_6forKeys6Int128VSgAFm_xtKF
Added: _$ss22KeyedDecodingContainerV6decode_6forKeys6Int128VAFm_xtKF
Added: _$ss22KeyedEncodingContainerV15encodeIfPresent_6forKeyys6Int128VSg_xtKF
Added: _$ss22KeyedEncodingContainerV6encode_6forKeyys6Int128V_xtKF
Added: _$ss24UnkeyedDecodingContainerP15decodeIfPresentys6Int128VSgAEmKFTj
Added: _$ss24UnkeyedDecodingContainerP15decodeIfPresentys6Int128VSgAEmKFTq
Added: _$ss24UnkeyedDecodingContainerP6decodeys6Int128VAEmKFTj
Added: _$ss24UnkeyedDecodingContainerP6decodeys6Int128VAEmKFTq
Added: _$ss24UnkeyedDecodingContainerPsE15decodeIfPresentys6Int128VSgAEmKF
Added: _$ss24UnkeyedDecodingContainerPsE6decodeys6Int128VAEmKF
Added: _$ss24UnkeyedEncodingContainerP6encode10contentsOfyqd___tKSTRd__s6Int128V7ElementRtd__lFTj
Added: _$ss24UnkeyedEncodingContainerP6encode10contentsOfyqd___tKSTRd__s6Int128V7ElementRtd__lFTq
Added: _$ss24UnkeyedEncodingContainerP6encodeyys6Int128VKFTj
Added: _$ss24UnkeyedEncodingContainerP6encodeyys6Int128VKFTq
Added: _$ss24UnkeyedEncodingContainerPsE6encode10contentsOfyqd___tKSTRd__s6Int128V7ElementRtd__lF
Added: _$ss24UnkeyedEncodingContainerPsE6encodeyys6Int128VKF
Added: _$ss28SingleValueDecodingContainerP6decodeys6Int128VAEmKFTj
Added: _$ss28SingleValueDecodingContainerP6decodeys6Int128VAEmKFTq
Added: _$ss28SingleValueDecodingContainerPsE6decodeys6Int128VAEmKF
Added: _$ss28SingleValueEncodingContainerP6encodeyys6Int128VKFTj
Added: _$ss28SingleValueEncodingContainerP6encodeyys6Int128VKFTq
Added: _$ss28SingleValueEncodingContainerPsE6encodeyys6Int128VKF
Added: _$ss30KeyedDecodingContainerProtocolP15decodeIfPresent_6forKeys6Int128VSgAFm_0I0QztKFTj
Added: _$ss30KeyedDecodingContainerProtocolP15decodeIfPresent_6forKeys6Int128VSgAFm_0I0QztKFTq
Added: _$ss30KeyedDecodingContainerProtocolP6decode_6forKeys6Int128VAFm_0G0QztKFTj
Added: _$ss30KeyedDecodingContainerProtocolP6decode_6forKeys6Int128VAFm_0G0QztKFTq
Added: _$ss30KeyedDecodingContainerProtocolPsE15decodeIfPresent_6forKeys6Int128VSgAFm_0I0QztKF
Added: _$ss30KeyedDecodingContainerProtocolPsE6decode_6forKeys6Int128VAFm_0G0QztKF
Added: _$ss30KeyedEncodingContainerProtocolP15encodeIfPresent_6forKeyys6Int128VSg_0I0QztKFTj
Added: _$ss30KeyedEncodingContainerProtocolP15encodeIfPresent_6forKeyys6Int128VSg_0I0QztKFTq
Added: _$ss30KeyedEncodingContainerProtocolP6encode_6forKeyys6Int128V_0G0QztKFTj
Added: _$ss30KeyedEncodingContainerProtocolP6encode_6forKeyys6Int128V_0G0QztKFTq
Added: _$ss30KeyedEncodingContainerProtocolPsE15encodeIfPresent_6forKeyys6Int128VSg_0I0QztKF
Added: _$ss30KeyedEncodingContainerProtocolPsE6encode_6forKeyys6Int128V_0G0QztKF
Added: _$ss6Int128V10bitPatternABs7UInt128V_tcfC
Added: _$ss6Int128V11byteSwappedABvg
Added: _$ss6Int128V11byteSwappedABvpMV
Added: _$ss6Int128V12customMirrors0C0Vvg
Added: _$ss6Int128V12customMirrors0C0VvpMV
Added: _$ss6Int128V15_truncatingBitsABSu_tcfC
Added: _$ss6Int128V15nonzeroBitCountSivg
Added: _$ss6Int128V15nonzeroBitCountSivpMV
Added: _$ss6Int128V18truncatingIfNeededABx_tcSzRzlufC
Added: _$ss6Int128V19leadingZeroBitCountSivg
Added: _$ss6Int128V19leadingZeroBitCountSivpMV
Added: _$ss6Int128V1doiyA2B_ABtFZ
Added: _$ss6Int128V1loiySbAB_ABtFZ
Added: _$ss6Int128V1moiyA2B_ABtFZ
Added: _$ss6Int128V1poiyA2B_ABtFZ
Added: _$ss6Int128V1roiyA2B_ABtFZ
Added: _$ss6Int128V1soiyA2B_ABtFZ
Added: _$ss6Int128V20trailingZeroBitCountSivg
Added: _$ss6Int128V20trailingZeroBitCountSivpMV
Added: _$ss6Int128V22_builtinIntegerLiteralABBI_tcfC
Added: _$ss6Int128V23addingReportingOverflowyAB12partialValue_Sb8overflowtABF
Added: _$ss6Int128V24dividedReportingOverflow2byAB12partialValue_Sb8overflowtAB_tF
Added: _$ss6Int128V26remainderReportingOverflow10dividingByAB12partialValue_Sb8overflowtAB_tF
Added: _$ss6Int128V27multipliedReportingOverflow2byAB12partialValue_Sb8overflowtAB_tF
Added: _$ss6Int128V28subtractingReportingOverflowyAB12partialValue_Sb8overflowtABF
Added: _$ss6Int128V2aeoiyyABz_ABtFZ
Added: _$ss6Int128V2amoiyA2B_ABtFZ
Added: _$ss6Int128V2deoiyyABz_ABtFZ
Added: _$ss6Int128V2eeoiySbAB_ABtFZ
Added: _$ss6Int128V2meoiyyABz_ABtFZ
Added: _$ss6Int128V2oeoiyyABz_ABtFZ
Added: _$ss6Int128V2reoiyyABz_ABtFZ
Added: _$ss6Int128V2xeoiyyABz_ABtFZ
Added: _$ss6Int128V4_low5_highABs6UInt64V_s5Int64VtcfC
Added: _$ss6Int128V4_lows6UInt64Vvg
Added: _$ss6Int128V4_lows6UInt64VvpMV
Added: _$ss6Int128V3maxABvgZ
Added: _$ss6Int128V3minABvgZ
Added: _$ss6Int128V4aggeoiyyABz_ABtFZ
Added: _$ss6Int128V4alleoiyyABz_ABtFZ
Added: _$ss6Int128V4fromABs7Decoder_p_tKcfC
Added: _$ss6Int128V4hash4intoys6HasherVz_tF
Added: _$ss6Int128V5_highs5Int64Vvg
Added: _$ss6Int128V5_highs5Int64VvpMV
Added: _$ss6Int128V4zeroABvgZ
Added: _$ss6Int128V5wordss7UInt128V5WordsVvg
Added: _$ss6Int128V5wordss7UInt128V5WordsVvpMV
Added: _$ss6Int128V6_valueBi128_vM
Added: _$ss6Int128V6_valueBi128_vg
Added: _$ss6Int128V6_valueBi128_vpMV
Added: _$ss6Int128V6_valueBi128_vs
Added: _$ss6Int128V6encode2toys7Encoder_p_tKF
Added: _$ss6Int128V7exactlyABSgx_tcSBRzlufC
Added: _$ss6Int128V7exactlyABSgx_tcSzRzlufC
Added: _$ss6Int128V8bitWidthSivgZ
Added: _$ss6Int128V8clampingABx_tcSzRzlufC
Added: _$ss6Int128V9hashValueSivg
Added: _$ss6Int128V9hashValueSivpMV
Added: _$ss6Int128V9magnitudes7UInt128Vvg
Added: _$ss6Int128V9magnitudes7UInt128VvpMV
Added: _$ss6Int128VMa
Added: _$ss6Int128VMn
Added: _$ss6Int128VN
Added: _$ss6Int128VSEsMc
Added: _$ss6Int128VSEsWP
Added: _$ss6Int128VSHsMc
Added: _$ss6Int128VSHsWP
Added: _$ss6Int128VSLsMc
Added: _$ss6Int128VSLsWP
Added: _$ss6Int128VSQsMc
Added: _$ss6Int128VSQsWP
Added: _$ss6Int128VSZsMc
Added: _$ss6Int128VSZsWP
Added: _$ss6Int128VSesMc
Added: _$ss6Int128VSesWP
Added: _$ss6Int128VSjsMc
Added: _$ss6Int128VSjsWP
Added: _$ss6Int128VSxsMc
Added: _$ss6Int128VSxsWP
Added: _$ss6Int128VSzsMc
Added: _$ss6Int128VSzsWP
Added: _$ss6Int128Vs13SignedNumericsMc
Added: _$ss6Int128Vs13SignedNumericsWP
Added: _$ss6Int128Vs17CustomReflectablesMc
Added: _$ss6Int128Vs17CustomReflectablesWP
Added: _$ss6Int128Vs17FixedWidthIntegersMc
Added: _$ss6Int128Vs17FixedWidthIntegersWP
Added: _$ss6Int128Vs18AdditiveArithmeticsMc
Added: _$ss6Int128Vs18AdditiveArithmeticsWP
Added: _$ss6Int128Vs23CustomStringConvertiblesMc
Added: _$ss6Int128Vs23CustomStringConvertiblesWP
Added: _$ss6Int128Vs25LosslessStringConvertiblesMc
Added: _$ss6Int128Vs25LosslessStringConvertiblesWP
Added: _$ss6Int128Vs27ExpressibleByIntegerLiteralsMc
Added: _$ss6Int128Vs27ExpressibleByIntegerLiteralsWP
Added: _$ss6Int128Vs35_ExpressibleByBuiltinIntegerLiteralsMc
Added: _$ss6Int128Vs35_ExpressibleByBuiltinIntegerLiteralsWP
Added: _$ss6Int128VyABBi128_cfC
Added: _$ss6Int128VyABxcSBRzlufC
Added: _$ss6Int128VyABxcSzRzlufC
// UInt128
Added: _$sSYsSeRzs7UInt128V8RawValueSYRtzrlE4fromxs7Decoder_p_tKcfC
Added: _$ss22KeyedDecodingContainerV15decodeIfPresent_6forKeys7UInt128VSgAFm_xtKF
Added: _$ss22KeyedDecodingContainerV6decode_6forKeys7UInt128VAFm_xtKF
Added: _$ss22KeyedEncodingContainerV15encodeIfPresent_6forKeyys7UInt128VSg_xtKF
Added: _$ss22KeyedEncodingContainerV6encode_6forKeyys7UInt128V_xtKF
Added: _$ss24UnkeyedDecodingContainerP15decodeIfPresentys7UInt128VSgAEmKFTj
Added: _$ss24UnkeyedDecodingContainerP15decodeIfPresentys7UInt128VSgAEmKFTq
Added: _$ss24UnkeyedDecodingContainerP6decodeys7UInt128VAEmKFTj
Added: _$ss24UnkeyedDecodingContainerP6decodeys7UInt128VAEmKFTq
Added: _$ss24UnkeyedDecodingContainerPsE15decodeIfPresentys7UInt128VSgAEmKF
Added: _$ss24UnkeyedDecodingContainerPsE6decodeys7UInt128VAEmKF
Added: _$ss24UnkeyedEncodingContainerP6encode10contentsOfyqd___tKSTRd__s7UInt128V7ElementRtd__lFTj
Added: _$ss24UnkeyedEncodingContainerP6encode10contentsOfyqd___tKSTRd__s7UInt128V7ElementRtd__lFTq
Added: _$ss24UnkeyedEncodingContainerP6encodeyys7UInt128VKFTj
Added: _$ss24UnkeyedEncodingContainerP6encodeyys7UInt128VKFTq
Added: _$ss24UnkeyedEncodingContainerPsE6encode10contentsOfyqd___tKSTRd__s7UInt128V7ElementRtd__lF
Added: _$ss24UnkeyedEncodingContainerPsE6encodeyys7UInt128VKF
Added: _$ss28SingleValueDecodingContainerP6decodeys7UInt128VAEmKFTj
Added: _$ss28SingleValueDecodingContainerP6decodeys7UInt128VAEmKFTq
Added: _$ss28SingleValueDecodingContainerPsE6decodeys7UInt128VAEmKF
Added: _$ss28SingleValueEncodingContainerP6encodeyys7UInt128VKFTj
Added: _$ss28SingleValueEncodingContainerP6encodeyys7UInt128VKFTq
Added: _$ss28SingleValueEncodingContainerPsE6encodeyys7UInt128VKF
Added: _$ss30KeyedDecodingContainerProtocolP15decodeIfPresent_6forKeys7UInt128VSgAFm_0I0QztKFTj
Added: _$ss30KeyedDecodingContainerProtocolP15decodeIfPresent_6forKeys7UInt128VSgAFm_0I0QztKFTq
Added: _$ss30KeyedDecodingContainerProtocolP6decode_6forKeys7UInt128VAFm_0G0QztKFTj
Added: _$ss30KeyedDecodingContainerProtocolP6decode_6forKeys7UInt128VAFm_0G0QztKFTq
Added: _$ss30KeyedDecodingContainerProtocolPsE15decodeIfPresent_6forKeys7UInt128VSgAFm_0I0QztKF
Added: _$ss30KeyedDecodingContainerProtocolPsE6decode_6forKeys7UInt128VAFm_0G0QztKF
Added: _$ss30KeyedEncodingContainerProtocolP15encodeIfPresent_6forKeyys7UInt128VSg_0I0QztKFTj
Added: _$ss30KeyedEncodingContainerProtocolP15encodeIfPresent_6forKeyys7UInt128VSg_0I0QztKFTq
Added: _$ss30KeyedEncodingContainerProtocolP6encode_6forKeyys7UInt128V_0G0QztKFTj
Added: _$ss30KeyedEncodingContainerProtocolP6encode_6forKeyys7UInt128V_0G0QztKFTq
Added: _$ss30KeyedEncodingContainerProtocolPsE15encodeIfPresent_6forKeyys7UInt128VSg_0I0QztKF
Added: _$ss30KeyedEncodingContainerProtocolPsE6encode_6forKeyys7UInt128V_0G0QztKF
Added: _$ss7UInt128V10bitPatternABs6Int128V_tcfC
Added: _$ss7UInt128V11byteSwappedABvg
Added: _$ss7UInt128V11byteSwappedABvpMV
Added: _$ss7UInt128V12customMirrors0C0Vvg
Added: _$ss7UInt128V12customMirrors0C0VvpMV
Added: _$ss7UInt128V15_truncatingBitsABSu_tcfC
Added: _$ss7UInt128V15nonzeroBitCountSivg
Added: _$ss7UInt128V15nonzeroBitCountSivpMV
Added: _$ss7UInt128V18truncatingIfNeededABx_tcSzRzlufC
Added: _$ss7UInt128V19leadingZeroBitCountSivg
Added: _$ss7UInt128V19leadingZeroBitCountSivpMV
Added: _$ss7UInt128V1doiyA2B_ABtFZ
Added: _$ss7UInt128V1loiySbAB_ABtFZ
Added: _$ss7UInt128V1moiyA2B_ABtFZ
Added: _$ss7UInt128V1poiyA2B_ABtFZ
Added: _$ss7UInt128V1roiyA2B_ABtFZ
Added: _$ss7UInt128V1soiyA2B_ABtFZ
Added: _$ss7UInt128V20trailingZeroBitCountSivg
Added: _$ss7UInt128V20trailingZeroBitCountSivpMV
Added: _$ss7UInt128V22_builtinIntegerLiteralABBI_tcfC
Added: _$ss7UInt128V23addingReportingOverflowyAB12partialValue_Sb8overflowtABF
Added: _$ss7UInt128V24dividedReportingOverflow2byAB12partialValue_Sb8overflowtAB_tF
Added: _$ss7UInt128V26remainderReportingOverflow10dividingByAB12partialValue_Sb8overflowtAB_tF
Added: _$ss7UInt128V27multipliedReportingOverflow2byAB12partialValue_Sb8overflowtAB_tF
Added: _$ss7UInt128V28subtractingReportingOverflowyAB12partialValue_Sb8overflowtABF
Added: _$ss7UInt128V2aeoiyyABz_ABtFZ
Added: _$ss7UInt128V2deoiyyABz_ABtFZ
Added: _$ss7UInt128V2eeoiySbAB_ABtFZ
Added: _$ss7UInt128V2meoiyyABz_ABtFZ
Added: _$ss7UInt128V2oeoiyyABz_ABtFZ
Added: _$ss7UInt128V2reoiyyABz_ABtFZ
Added: _$ss7UInt128V2xeoiyyABz_ABtFZ
Added: _$ss7UInt128V4_low5_highABs6UInt64V_AFtcfC
Added: _$ss7UInt128V4_lows6UInt64Vvg
Added: _$ss7UInt128V4_lows6UInt64VvpMV
Added: _$ss7UInt128V3maxABvgZ
Added: _$ss7UInt128V3minABvgZ
Added: _$ss7UInt128V4aggeoiyyABz_ABtFZ
Added: _$ss7UInt128V4alleoiyyABz_ABtFZ
Added: _$ss7UInt128V4fromABs7Decoder_p_tKcfC
Added: _$ss7UInt128V4hash4intoys6HasherVz_tF
Added: _$ss7UInt128V5_highs6UInt64Vvg
Added: _$ss7UInt128V5_highs6UInt64VvpMV
Added: _$ss7UInt128V4zeroABvgZ
Added: _$ss7UInt128V5WordsV10startIndexSivg
Added: _$ss7UInt128V5WordsV10startIndexSivpMV
Added: _$ss7UInt128V5WordsV5countSivg
Added: _$ss7UInt128V5WordsV5countSivpMV
Added: _$ss7UInt128V5WordsV5index5afterS2i_tF
Added: _$ss7UInt128V5WordsV5index6beforeS2i_tF
Added: _$ss7UInt128V5WordsV6_valueABvg
Added: _$ss7UInt128V5WordsV6_valueABvpMV
Added: _$ss7UInt128V5WordsV6_valueAdB_tcfC
Added: _$ss7UInt128V5WordsV7indicesSnySiGvg
Added: _$ss7UInt128V5WordsV7indicesSnySiGvpMV
Added: _$ss7UInt128V5WordsV8endIndexSivg
Added: _$ss7UInt128V5WordsV8endIndexSivpMV
Added: _$ss7UInt128V5WordsVMa
Added: _$ss7UInt128V5WordsVMn
Added: _$ss7UInt128V5WordsVN
Added: _$ss7UInt128V5WordsVSKsMc
Added: _$ss7UInt128V5WordsVSKsWP
Added: _$ss7UInt128V5WordsVSTsMc
Added: _$ss7UInt128V5WordsVSTsWP
Added: _$ss7UInt128V5WordsVSksMc
Added: _$ss7UInt128V5WordsVSksWP
Added: _$ss7UInt128V5WordsVSlsMc
Added: _$ss7UInt128V5WordsVSlsWP
Added: _$ss7UInt128V5WordsVySuSicig
Added: _$ss7UInt128V5WordsVySuSicipMV
Added: _$ss7UInt128V5wordsAB5WordsVvg
Added: _$ss7UInt128V5wordsAB5WordsVvpMV
Added: _$ss7UInt128V6_valueBi128_vM
Added: _$ss7UInt128V6_valueBi128_vg
Added: _$ss7UInt128V6_valueBi128_vpMV
Added: _$ss7UInt128V6_valueBi128_vs
Added: _$ss7UInt128V6encode2toys7Encoder_p_tKF
Added: _$ss7UInt128V7exactlyABSgx_tcSBRzlufC
Added: _$ss7UInt128V7exactlyABSgx_tcSzRzlufC
Added: _$ss7UInt128V8bitWidthSivgZ
Added: _$ss7UInt128V8clampingABx_tcSzRzlufC
Added: _$ss7UInt128V9hashValueSivg
Added: _$ss7UInt128V9hashValueSivpMV
Added: _$ss7UInt128V9magnitudeABvg
Added: _$ss7UInt128V9magnitudeABvpMV
Added: _$ss7UInt128VMa
Added: _$ss7UInt128VMn
Added: _$ss7UInt128VN
Added: _$ss7UInt128VSEsMc
Added: _$ss7UInt128VSEsWP
Added: _$ss7UInt128VSHsMc
Added: _$ss7UInt128VSHsWP
Added: _$ss7UInt128VSLsMc
Added: _$ss7UInt128VSLsWP
Added: _$ss7UInt128VSQsMc
Added: _$ss7UInt128VSQsWP
Added: _$ss7UInt128VSUsMc
Added: _$ss7UInt128VSUsWP
Added: _$ss7UInt128VSesMc
Added: _$ss7UInt128VSesWP
Added: _$ss7UInt128VSjsMc
Added: _$ss7UInt128VSjsWP
Added: _$ss7UInt128VSxsMc
Added: _$ss7UInt128VSxsWP
Added: _$ss7UInt128VSzsMc
Added: _$ss7UInt128VSzsWP
Added: _$ss7UInt128Vs17CustomReflectablesMc
Added: _$ss7UInt128Vs17CustomReflectablesWP
Added: _$ss7UInt128Vs17FixedWidthIntegersMc
Added: _$ss7UInt128Vs17FixedWidthIntegersWP
Added: _$ss7UInt128Vs18AdditiveArithmeticsMc
Added: _$ss7UInt128Vs18AdditiveArithmeticsWP
Added: _$ss7UInt128Vs23CustomStringConvertiblesMc
Added: _$ss7UInt128Vs23CustomStringConvertiblesWP
Added: _$ss7UInt128Vs25LosslessStringConvertiblesMc
Added: _$ss7UInt128Vs25LosslessStringConvertiblesWP
Added: _$ss7UInt128Vs27ExpressibleByIntegerLiteralsMc
Added: _$ss7UInt128Vs27ExpressibleByIntegerLiteralsWP
Added: _$ss7UInt128Vs35_ExpressibleByBuiltinIntegerLiteralsMc
Added: _$ss7UInt128Vs35_ExpressibleByBuiltinIntegerLiteralsWP
Added: _$ss7UInt128VyABBi128_cfC
Added: _$ss7UInt128VyABxcSBRzlufC
Added: _$ss7UInt128VyABxcSzRzlufC
// Fixed-width integer &* customization point
Added: _$ss17FixedWidthIntegerP2amoiyxx_xtFZTj
Added: _$ss17FixedWidthIntegerP2amoiyxx_xtFZTq
// Runtime Symbols
Added: __swift_pod_copy
Added: __swift_pod_destroy
@@ -257,4 +560,4 @@ Added: __swift_willThrowTypedImpl
Added: __swift_enableSwizzlingOfAllocationAndRefCountingFunctions_forInstrumentsOnly
// Runtime bincompat functions for Concurrency runtime to detect legacy mode
Added: _swift_bincompat_useLegacyNonCrashingExecutorChecks
Added: _swift_bincompat_useLegacyNonCrashingExecutorChecks

View File

@@ -644,3 +644,14 @@ Added: _$ss9UnmanagedVyxG15Synchronization27AtomicOptionalRepresentableADWP
// protocol conformance descriptor for <A where A: Synchronization.AtomicOptionalRepresentable> A? : Synchronization.AtomicRepresentable in Synchronization
Added: _$sxSg15Synchronization19AtomicRepresentableA2B0b8OptionalC0RzlMc
// protocol conformance descriptor for Swift.Int128 : Synchronization.AtomicRepresentable in Synchronization
Added: _$ss6Int128V15Synchronization19AtomicRepresentableACMc
// protocol witness table for Swift.Int128 : Synchronization.AtomicRepresentable in Synchronization
Added: _$ss6Int128V15Synchronization19AtomicRepresentableACWP
// protocol conformance descriptor for Swift.UInt128 : Synchronization.AtomicRepresentable in Synchronization
Added: _$ss7UInt128V15Synchronization19AtomicRepresentableACMc
// protocol witness table for Swift.UInt128 : Synchronization.AtomicRepresentable in Synchronization
Added: _$ss7UInt128V15Synchronization19AtomicRepresentableACWP

View File

@@ -245,6 +245,309 @@ Added: _$sSR7isEmptySbvpMV
// property descriptor for Swift.UnsafeMutableBufferPointer.isEmpty : Swift.Bool
Added: _$sSr7isEmptySbvpMV
// Int128
Added: _$sSYsSERzs6Int128V8RawValueSYRtzrlE6encode2toys7Encoder_p_tKF
Added: _$sSYsSERzs7UInt128V8RawValueSYRtzrlE6encode2toys7Encoder_p_tKF
Added: _$sSYsSeRzs6Int128V8RawValueSYRtzrlE4fromxs7Decoder_p_tKcfC
Added: _$ss22KeyedDecodingContainerV15decodeIfPresent_6forKeys6Int128VSgAFm_xtKF
Added: _$ss22KeyedDecodingContainerV6decode_6forKeys6Int128VAFm_xtKF
Added: _$ss22KeyedEncodingContainerV15encodeIfPresent_6forKeyys6Int128VSg_xtKF
Added: _$ss22KeyedEncodingContainerV6encode_6forKeyys6Int128V_xtKF
Added: _$ss24UnkeyedDecodingContainerP15decodeIfPresentys6Int128VSgAEmKFTj
Added: _$ss24UnkeyedDecodingContainerP15decodeIfPresentys6Int128VSgAEmKFTq
Added: _$ss24UnkeyedDecodingContainerP6decodeys6Int128VAEmKFTj
Added: _$ss24UnkeyedDecodingContainerP6decodeys6Int128VAEmKFTq
Added: _$ss24UnkeyedDecodingContainerPsE15decodeIfPresentys6Int128VSgAEmKF
Added: _$ss24UnkeyedDecodingContainerPsE6decodeys6Int128VAEmKF
Added: _$ss24UnkeyedEncodingContainerP6encode10contentsOfyqd___tKSTRd__s6Int128V7ElementRtd__lFTj
Added: _$ss24UnkeyedEncodingContainerP6encode10contentsOfyqd___tKSTRd__s6Int128V7ElementRtd__lFTq
Added: _$ss24UnkeyedEncodingContainerP6encodeyys6Int128VKFTj
Added: _$ss24UnkeyedEncodingContainerP6encodeyys6Int128VKFTq
Added: _$ss24UnkeyedEncodingContainerPsE6encode10contentsOfyqd___tKSTRd__s6Int128V7ElementRtd__lF
Added: _$ss24UnkeyedEncodingContainerPsE6encodeyys6Int128VKF
Added: _$ss28SingleValueDecodingContainerP6decodeys6Int128VAEmKFTj
Added: _$ss28SingleValueDecodingContainerP6decodeys6Int128VAEmKFTq
Added: _$ss28SingleValueDecodingContainerPsE6decodeys6Int128VAEmKF
Added: _$ss28SingleValueEncodingContainerP6encodeyys6Int128VKFTj
Added: _$ss28SingleValueEncodingContainerP6encodeyys6Int128VKFTq
Added: _$ss28SingleValueEncodingContainerPsE6encodeyys6Int128VKF
Added: _$ss30KeyedDecodingContainerProtocolP15decodeIfPresent_6forKeys6Int128VSgAFm_0I0QztKFTj
Added: _$ss30KeyedDecodingContainerProtocolP15decodeIfPresent_6forKeys6Int128VSgAFm_0I0QztKFTq
Added: _$ss30KeyedDecodingContainerProtocolP6decode_6forKeys6Int128VAFm_0G0QztKFTj
Added: _$ss30KeyedDecodingContainerProtocolP6decode_6forKeys6Int128VAFm_0G0QztKFTq
Added: _$ss30KeyedDecodingContainerProtocolPsE15decodeIfPresent_6forKeys6Int128VSgAFm_0I0QztKF
Added: _$ss30KeyedDecodingContainerProtocolPsE6decode_6forKeys6Int128VAFm_0G0QztKF
Added: _$ss30KeyedEncodingContainerProtocolP15encodeIfPresent_6forKeyys6Int128VSg_0I0QztKFTj
Added: _$ss30KeyedEncodingContainerProtocolP15encodeIfPresent_6forKeyys6Int128VSg_0I0QztKFTq
Added: _$ss30KeyedEncodingContainerProtocolP6encode_6forKeyys6Int128V_0G0QztKFTj
Added: _$ss30KeyedEncodingContainerProtocolP6encode_6forKeyys6Int128V_0G0QztKFTq
Added: _$ss30KeyedEncodingContainerProtocolPsE15encodeIfPresent_6forKeyys6Int128VSg_0I0QztKF
Added: _$ss30KeyedEncodingContainerProtocolPsE6encode_6forKeyys6Int128V_0G0QztKF
Added: _$ss6Int128V10bitPatternABs7UInt128V_tcfC
Added: _$ss6Int128V11byteSwappedABvg
Added: _$ss6Int128V11byteSwappedABvpMV
Added: _$ss6Int128V12customMirrors0C0Vvg
Added: _$ss6Int128V12customMirrors0C0VvpMV
Added: _$ss6Int128V15_truncatingBitsABSu_tcfC
Added: _$ss6Int128V15nonzeroBitCountSivg
Added: _$ss6Int128V15nonzeroBitCountSivpMV
Added: _$ss6Int128V18truncatingIfNeededABx_tcSzRzlufC
Added: _$ss6Int128V19leadingZeroBitCountSivg
Added: _$ss6Int128V19leadingZeroBitCountSivpMV
Added: _$ss6Int128V1doiyA2B_ABtFZ
Added: _$ss6Int128V1loiySbAB_ABtFZ
Added: _$ss6Int128V1moiyA2B_ABtFZ
Added: _$ss6Int128V1poiyA2B_ABtFZ
Added: _$ss6Int128V1roiyA2B_ABtFZ
Added: _$ss6Int128V1soiyA2B_ABtFZ
Added: _$ss6Int128V20trailingZeroBitCountSivg
Added: _$ss6Int128V20trailingZeroBitCountSivpMV
Added: _$ss6Int128V22_builtinIntegerLiteralABBI_tcfC
Added: _$ss6Int128V23addingReportingOverflowyAB12partialValue_Sb8overflowtABF
Added: _$ss6Int128V24dividedReportingOverflow2byAB12partialValue_Sb8overflowtAB_tF
Added: _$ss6Int128V26remainderReportingOverflow10dividingByAB12partialValue_Sb8overflowtAB_tF
Added: _$ss6Int128V27multipliedReportingOverflow2byAB12partialValue_Sb8overflowtAB_tF
Added: _$ss6Int128V28subtractingReportingOverflowyAB12partialValue_Sb8overflowtABF
Added: _$ss6Int128V2aeoiyyABz_ABtFZ
Added: _$ss6Int128V2amoiyA2B_ABtFZ
Added: _$ss6Int128V2deoiyyABz_ABtFZ
Added: _$ss6Int128V2eeoiySbAB_ABtFZ
Added: _$ss6Int128V2meoiyyABz_ABtFZ
Added: _$ss6Int128V2oeoiyyABz_ABtFZ
Added: _$ss6Int128V2reoiyyABz_ABtFZ
Added: _$ss6Int128V2xeoiyyABz_ABtFZ
Added: _$ss6Int128V4_low5_highABs6UInt64V_s5Int64VtcfC
Added: _$ss6Int128V4_lows6UInt64Vvg
Added: _$ss6Int128V4_lows6UInt64VvpMV
Added: _$ss6Int128V3maxABvgZ
Added: _$ss6Int128V3minABvgZ
Added: _$ss6Int128V4aggeoiyyABz_ABtFZ
Added: _$ss6Int128V4alleoiyyABz_ABtFZ
Added: _$ss6Int128V4fromABs7Decoder_p_tKcfC
Added: _$ss6Int128V4hash4intoys6HasherVz_tF
Added: _$ss6Int128V5_highs5Int64Vvg
Added: _$ss6Int128V5_highs5Int64VvpMV
Added: _$ss6Int128V4zeroABvgZ
Added: _$ss6Int128V5wordss7UInt128V5WordsVvg
Added: _$ss6Int128V5wordss7UInt128V5WordsVvpMV
Added: _$ss6Int128V6_valueBi128_vM
Added: _$ss6Int128V6_valueBi128_vg
Added: _$ss6Int128V6_valueBi128_vpMV
Added: _$ss6Int128V6_valueBi128_vs
Added: _$ss6Int128V6encode2toys7Encoder_p_tKF
Added: _$ss6Int128V7exactlyABSgx_tcSBRzlufC
Added: _$ss6Int128V7exactlyABSgx_tcSzRzlufC
Added: _$ss6Int128V8bitWidthSivgZ
Added: _$ss6Int128V8clampingABx_tcSzRzlufC
Added: _$ss6Int128V9hashValueSivg
Added: _$ss6Int128V9hashValueSivpMV
Added: _$ss6Int128V9magnitudes7UInt128Vvg
Added: _$ss6Int128V9magnitudes7UInt128VvpMV
Added: _$ss6Int128VMa
Added: _$ss6Int128VMn
Added: _$ss6Int128VN
Added: _$ss6Int128VSEsMc
Added: _$ss6Int128VSEsWP
Added: _$ss6Int128VSHsMc
Added: _$ss6Int128VSHsWP
Added: _$ss6Int128VSLsMc
Added: _$ss6Int128VSLsWP
Added: _$ss6Int128VSQsMc
Added: _$ss6Int128VSQsWP
Added: _$ss6Int128VSZsMc
Added: _$ss6Int128VSZsWP
Added: _$ss6Int128VSesMc
Added: _$ss6Int128VSesWP
Added: _$ss6Int128VSjsMc
Added: _$ss6Int128VSjsWP
Added: _$ss6Int128VSxsMc
Added: _$ss6Int128VSxsWP
Added: _$ss6Int128VSzsMc
Added: _$ss6Int128VSzsWP
Added: _$ss6Int128Vs13SignedNumericsMc
Added: _$ss6Int128Vs13SignedNumericsWP
Added: _$ss6Int128Vs17CustomReflectablesMc
Added: _$ss6Int128Vs17CustomReflectablesWP
Added: _$ss6Int128Vs17FixedWidthIntegersMc
Added: _$ss6Int128Vs17FixedWidthIntegersWP
Added: _$ss6Int128Vs18AdditiveArithmeticsMc
Added: _$ss6Int128Vs18AdditiveArithmeticsWP
Added: _$ss6Int128Vs23CustomStringConvertiblesMc
Added: _$ss6Int128Vs23CustomStringConvertiblesWP
Added: _$ss6Int128Vs25LosslessStringConvertiblesMc
Added: _$ss6Int128Vs25LosslessStringConvertiblesWP
Added: _$ss6Int128Vs27ExpressibleByIntegerLiteralsMc
Added: _$ss6Int128Vs27ExpressibleByIntegerLiteralsWP
Added: _$ss6Int128Vs35_ExpressibleByBuiltinIntegerLiteralsMc
Added: _$ss6Int128Vs35_ExpressibleByBuiltinIntegerLiteralsWP
Added: _$ss6Int128VyABBi128_cfC
Added: _$ss6Int128VyABxcSBRzlufC
Added: _$ss6Int128VyABxcSzRzlufC
// UInt128
Added: _$sSYsSeRzs7UInt128V8RawValueSYRtzrlE4fromxs7Decoder_p_tKcfC
Added: _$ss22KeyedDecodingContainerV15decodeIfPresent_6forKeys7UInt128VSgAFm_xtKF
Added: _$ss22KeyedDecodingContainerV6decode_6forKeys7UInt128VAFm_xtKF
Added: _$ss22KeyedEncodingContainerV15encodeIfPresent_6forKeyys7UInt128VSg_xtKF
Added: _$ss22KeyedEncodingContainerV6encode_6forKeyys7UInt128V_xtKF
Added: _$ss24UnkeyedDecodingContainerP15decodeIfPresentys7UInt128VSgAEmKFTj
Added: _$ss24UnkeyedDecodingContainerP15decodeIfPresentys7UInt128VSgAEmKFTq
Added: _$ss24UnkeyedDecodingContainerP6decodeys7UInt128VAEmKFTj
Added: _$ss24UnkeyedDecodingContainerP6decodeys7UInt128VAEmKFTq
Added: _$ss24UnkeyedDecodingContainerPsE15decodeIfPresentys7UInt128VSgAEmKF
Added: _$ss24UnkeyedDecodingContainerPsE6decodeys7UInt128VAEmKF
Added: _$ss24UnkeyedEncodingContainerP6encode10contentsOfyqd___tKSTRd__s7UInt128V7ElementRtd__lFTj
Added: _$ss24UnkeyedEncodingContainerP6encode10contentsOfyqd___tKSTRd__s7UInt128V7ElementRtd__lFTq
Added: _$ss24UnkeyedEncodingContainerP6encodeyys7UInt128VKFTj
Added: _$ss24UnkeyedEncodingContainerP6encodeyys7UInt128VKFTq
Added: _$ss24UnkeyedEncodingContainerPsE6encode10contentsOfyqd___tKSTRd__s7UInt128V7ElementRtd__lF
Added: _$ss24UnkeyedEncodingContainerPsE6encodeyys7UInt128VKF
Added: _$ss28SingleValueDecodingContainerP6decodeys7UInt128VAEmKFTj
Added: _$ss28SingleValueDecodingContainerP6decodeys7UInt128VAEmKFTq
Added: _$ss28SingleValueDecodingContainerPsE6decodeys7UInt128VAEmKF
Added: _$ss28SingleValueEncodingContainerP6encodeyys7UInt128VKFTj
Added: _$ss28SingleValueEncodingContainerP6encodeyys7UInt128VKFTq
Added: _$ss28SingleValueEncodingContainerPsE6encodeyys7UInt128VKF
Added: _$ss30KeyedDecodingContainerProtocolP15decodeIfPresent_6forKeys7UInt128VSgAFm_0I0QztKFTj
Added: _$ss30KeyedDecodingContainerProtocolP15decodeIfPresent_6forKeys7UInt128VSgAFm_0I0QztKFTq
Added: _$ss30KeyedDecodingContainerProtocolP6decode_6forKeys7UInt128VAFm_0G0QztKFTj
Added: _$ss30KeyedDecodingContainerProtocolP6decode_6forKeys7UInt128VAFm_0G0QztKFTq
Added: _$ss30KeyedDecodingContainerProtocolPsE15decodeIfPresent_6forKeys7UInt128VSgAFm_0I0QztKF
Added: _$ss30KeyedDecodingContainerProtocolPsE6decode_6forKeys7UInt128VAFm_0G0QztKF
Added: _$ss30KeyedEncodingContainerProtocolP15encodeIfPresent_6forKeyys7UInt128VSg_0I0QztKFTj
Added: _$ss30KeyedEncodingContainerProtocolP15encodeIfPresent_6forKeyys7UInt128VSg_0I0QztKFTq
Added: _$ss30KeyedEncodingContainerProtocolP6encode_6forKeyys7UInt128V_0G0QztKFTj
Added: _$ss30KeyedEncodingContainerProtocolP6encode_6forKeyys7UInt128V_0G0QztKFTq
Added: _$ss30KeyedEncodingContainerProtocolPsE15encodeIfPresent_6forKeyys7UInt128VSg_0I0QztKF
Added: _$ss30KeyedEncodingContainerProtocolPsE6encode_6forKeyys7UInt128V_0G0QztKF
Added: _$ss7UInt128V10bitPatternABs6Int128V_tcfC
Added: _$ss7UInt128V11byteSwappedABvg
Added: _$ss7UInt128V11byteSwappedABvpMV
Added: _$ss7UInt128V12customMirrors0C0Vvg
Added: _$ss7UInt128V12customMirrors0C0VvpMV
Added: _$ss7UInt128V15_truncatingBitsABSu_tcfC
Added: _$ss7UInt128V15nonzeroBitCountSivg
Added: _$ss7UInt128V15nonzeroBitCountSivpMV
Added: _$ss7UInt128V18truncatingIfNeededABx_tcSzRzlufC
Added: _$ss7UInt128V19leadingZeroBitCountSivg
Added: _$ss7UInt128V19leadingZeroBitCountSivpMV
Added: _$ss7UInt128V1doiyA2B_ABtFZ
Added: _$ss7UInt128V1loiySbAB_ABtFZ
Added: _$ss7UInt128V1moiyA2B_ABtFZ
Added: _$ss7UInt128V1poiyA2B_ABtFZ
Added: _$ss7UInt128V1roiyA2B_ABtFZ
Added: _$ss7UInt128V1soiyA2B_ABtFZ
Added: _$ss7UInt128V20trailingZeroBitCountSivg
Added: _$ss7UInt128V20trailingZeroBitCountSivpMV
Added: _$ss7UInt128V22_builtinIntegerLiteralABBI_tcfC
Added: _$ss7UInt128V23addingReportingOverflowyAB12partialValue_Sb8overflowtABF
Added: _$ss7UInt128V24dividedReportingOverflow2byAB12partialValue_Sb8overflowtAB_tF
Added: _$ss7UInt128V26remainderReportingOverflow10dividingByAB12partialValue_Sb8overflowtAB_tF
Added: _$ss7UInt128V27multipliedReportingOverflow2byAB12partialValue_Sb8overflowtAB_tF
Added: _$ss7UInt128V28subtractingReportingOverflowyAB12partialValue_Sb8overflowtABF
Added: _$ss7UInt128V2aeoiyyABz_ABtFZ
Added: _$ss7UInt128V2deoiyyABz_ABtFZ
Added: _$ss7UInt128V2eeoiySbAB_ABtFZ
Added: _$ss7UInt128V2meoiyyABz_ABtFZ
Added: _$ss7UInt128V2oeoiyyABz_ABtFZ
Added: _$ss7UInt128V2reoiyyABz_ABtFZ
Added: _$ss7UInt128V2xeoiyyABz_ABtFZ
Added: _$ss7UInt128V4_low5_highABs6UInt64V_AFtcfC
Added: _$ss7UInt128V4_lows6UInt64Vvg
Added: _$ss7UInt128V4_lows6UInt64VvpMV
Added: _$ss7UInt128V3maxABvgZ
Added: _$ss7UInt128V3minABvgZ
Added: _$ss7UInt128V4aggeoiyyABz_ABtFZ
Added: _$ss7UInt128V4alleoiyyABz_ABtFZ
Added: _$ss7UInt128V4fromABs7Decoder_p_tKcfC
Added: _$ss7UInt128V4hash4intoys6HasherVz_tF
Added: _$ss7UInt128V5_highs6UInt64Vvg
Added: _$ss7UInt128V5_highs6UInt64VvpMV
Added: _$ss7UInt128V4zeroABvgZ
Added: _$ss7UInt128V5WordsV10startIndexSivg
Added: _$ss7UInt128V5WordsV10startIndexSivpMV
Added: _$ss7UInt128V5WordsV5countSivg
Added: _$ss7UInt128V5WordsV5countSivpMV
Added: _$ss7UInt128V5WordsV5index5afterS2i_tF
Added: _$ss7UInt128V5WordsV5index6beforeS2i_tF
Added: _$ss7UInt128V5WordsV6_valueABvg
Added: _$ss7UInt128V5WordsV6_valueABvpMV
Added: _$ss7UInt128V5WordsV6_valueAdB_tcfC
Added: _$ss7UInt128V5WordsV7indicesSnySiGvg
Added: _$ss7UInt128V5WordsV7indicesSnySiGvpMV
Added: _$ss7UInt128V5WordsV8endIndexSivg
Added: _$ss7UInt128V5WordsV8endIndexSivpMV
Added: _$ss7UInt128V5WordsVMa
Added: _$ss7UInt128V5WordsVMn
Added: _$ss7UInt128V5WordsVN
Added: _$ss7UInt128V5WordsVSKsMc
Added: _$ss7UInt128V5WordsVSKsWP
Added: _$ss7UInt128V5WordsVSTsMc
Added: _$ss7UInt128V5WordsVSTsWP
Added: _$ss7UInt128V5WordsVSksMc
Added: _$ss7UInt128V5WordsVSksWP
Added: _$ss7UInt128V5WordsVSlsMc
Added: _$ss7UInt128V5WordsVSlsWP
Added: _$ss7UInt128V5WordsVySuSicig
Added: _$ss7UInt128V5WordsVySuSicipMV
Added: _$ss7UInt128V5wordsAB5WordsVvg
Added: _$ss7UInt128V5wordsAB5WordsVvpMV
Added: _$ss7UInt128V6_valueBi128_vM
Added: _$ss7UInt128V6_valueBi128_vg
Added: _$ss7UInt128V6_valueBi128_vpMV
Added: _$ss7UInt128V6_valueBi128_vs
Added: _$ss7UInt128V6encode2toys7Encoder_p_tKF
Added: _$ss7UInt128V7exactlyABSgx_tcSBRzlufC
Added: _$ss7UInt128V7exactlyABSgx_tcSzRzlufC
Added: _$ss7UInt128V8bitWidthSivgZ
Added: _$ss7UInt128V8clampingABx_tcSzRzlufC
Added: _$ss7UInt128V9hashValueSivg
Added: _$ss7UInt128V9hashValueSivpMV
Added: _$ss7UInt128V9magnitudeABvg
Added: _$ss7UInt128V9magnitudeABvpMV
Added: _$ss7UInt128VMa
Added: _$ss7UInt128VMn
Added: _$ss7UInt128VN
Added: _$ss7UInt128VSEsMc
Added: _$ss7UInt128VSEsWP
Added: _$ss7UInt128VSHsMc
Added: _$ss7UInt128VSHsWP
Added: _$ss7UInt128VSLsMc
Added: _$ss7UInt128VSLsWP
Added: _$ss7UInt128VSQsMc
Added: _$ss7UInt128VSQsWP
Added: _$ss7UInt128VSUsMc
Added: _$ss7UInt128VSUsWP
Added: _$ss7UInt128VSesMc
Added: _$ss7UInt128VSesWP
Added: _$ss7UInt128VSjsMc
Added: _$ss7UInt128VSjsWP
Added: _$ss7UInt128VSxsMc
Added: _$ss7UInt128VSxsWP
Added: _$ss7UInt128VSzsMc
Added: _$ss7UInt128VSzsWP
Added: _$ss7UInt128Vs17CustomReflectablesMc
Added: _$ss7UInt128Vs17CustomReflectablesWP
Added: _$ss7UInt128Vs17FixedWidthIntegersMc
Added: _$ss7UInt128Vs17FixedWidthIntegersWP
Added: _$ss7UInt128Vs18AdditiveArithmeticsMc
Added: _$ss7UInt128Vs18AdditiveArithmeticsWP
Added: _$ss7UInt128Vs23CustomStringConvertiblesMc
Added: _$ss7UInt128Vs23CustomStringConvertiblesWP
Added: _$ss7UInt128Vs25LosslessStringConvertiblesMc
Added: _$ss7UInt128Vs25LosslessStringConvertiblesWP
Added: _$ss7UInt128Vs27ExpressibleByIntegerLiteralsMc
Added: _$ss7UInt128Vs27ExpressibleByIntegerLiteralsWP
Added: _$ss7UInt128Vs35_ExpressibleByBuiltinIntegerLiteralsMc
Added: _$ss7UInt128Vs35_ExpressibleByBuiltinIntegerLiteralsWP
Added: _$ss7UInt128VyABBi128_cfC
Added: _$ss7UInt128VyABxcSBRzlufC
Added: _$ss7UInt128VyABxcSzRzlufC
// Fixed-width integer &* customization point
Added: _$ss17FixedWidthIntegerP2amoiyxx_xtFZTj
Added: _$ss17FixedWidthIntegerP2amoiyxx_xtFZTq
// Runtime Symbols
Added: __swift_pod_copy
Added: __swift_pod_destroy
@@ -257,4 +560,4 @@ Added: __swift_willThrowTypedImpl
Added: __swift_enableSwizzlingOfAllocationAndRefCountingFunctions_forInstrumentsOnly
// Runtime bincompat functions for Concurrency runtime to detect legacy mode
Added: _swift_bincompat_useLegacyNonCrashingExecutorChecks
Added: _swift_bincompat_useLegacyNonCrashingExecutorChecks

View File

@@ -637,3 +637,15 @@ Added: _$ss9UnmanagedVyxG15Synchronization27AtomicOptionalRepresentableADWP
// protocol conformance descriptor for <A where A: Synchronization.AtomicOptionalRepresentable> A? : Synchronization.AtomicRepresentable in Synchronization
Added: _$sxSg15Synchronization19AtomicRepresentableA2B0b8OptionalC0RzlMc
// protocol conformance descriptor for Swift.Int128 : Synchronization.AtomicRepresentable in Synchronization
Added: _$ss6Int128V15Synchronization19AtomicRepresentableACMc
// protocol witness table for Swift.Int128 : Synchronization.AtomicRepresentable in Synchronization
Added: _$ss6Int128V15Synchronization19AtomicRepresentableACWP
// protocol conformance descriptor for Swift.UInt128 : Synchronization.AtomicRepresentable in Synchronization
Added: _$ss7UInt128V15Synchronization19AtomicRepresentableACMc
// protocol witness table for Swift.UInt128 : Synchronization.AtomicRepresentable in Synchronization
Added: _$ss7UInt128V15Synchronization19AtomicRepresentableACWP

View File

@@ -317,3 +317,4 @@ TypeAlias UnsafeMutablePointer.Stride has generic signature change from <Pointee
TypeAlias UnsafePointer.Distance has generic signature change from <Pointee> to <Pointee where Pointee : ~Copyable>
TypeAlias UnsafePointer.Pointee has generic signature change from <Pointee> to <Pointee where Pointee : ~Copyable>
TypeAlias UnsafePointer.Stride has generic signature change from <Pointee> to <Pointee where Pointee : ~Copyable>
Func FixedWidthInteger.&*(_:_:) has been added as a protocol requirement

View File

@@ -807,5 +807,6 @@ Var UnsafePointer._rawValue is now with @_preInverseGenerics
Var UnsafePointer.hashValue has mangled name changing from 'Swift.UnsafePointer.hashValue : Swift.Int' to '(extension in Swift):Swift.UnsafePointer< where A: ~Swift.Copyable>.hashValue : Swift.Int'
Var UnsafePointer.hashValue is now with @_preInverseGenerics
Var UnsafePointer.pointee has been removed
Func FixedWidthInteger.&*(_:_:) has been added as a protocol requirement
// *** DO NOT DISABLE OR XFAIL THIS TEST. *** (See comment above.)

589
test/stdlib/Int128.swift Normal file
View File

@@ -0,0 +1,589 @@
// RUN: %target-run-simple-swift
// REQUIRES: executable_test
// UNSUPPORTED: use_os_stdlib, back_deployment_runtime
import StdlibUnittest
defer { runAllTests() }
var Int128Tests = TestSuite("Int128Tests")
Int128Tests.test("Memory layout") {
if #available(SwiftStdlib 6.0, *) {
// Size and stride must both be 16B.
expectEqual(MemoryLayout<Int128>.size, 16)
expectEqual(MemoryLayout<Int128>.stride, 16)
// Alignment must be at least that of UInt64, and no more than 16B.
expectTrue(
MemoryLayout<Int128>.alignment >= MemoryLayout<Int64>.alignment
)
expectTrue(MemoryLayout<Int128>.alignment <= 16)
// Size and stride must both be 16B.
expectEqual(MemoryLayout<UInt128>.size, 16)
expectEqual(MemoryLayout<UInt128>.stride, 16)
// Alignment must be at least that of UInt64, and no more than 16B.
expectTrue(
MemoryLayout<UInt128>.alignment >= MemoryLayout<UInt64>.alignment
)
expectTrue(MemoryLayout<UInt128>.alignment <= 16)
}
}
@available(SwiftStdlib 6.0, *)
extension UInt128 {
var high: UInt64 { UInt64(truncatingIfNeeded: self >> 64) }
var low: UInt64 { UInt64(truncatingIfNeeded: self) }
init(tenToThe n: Int) {
let tens: [UInt64] = [
1,
10,
100,
1000,
10000,
100000,
1000000,
10000000,
100000000,
1000000000,
10000000000,
100000000000,
1000000000000,
10000000000000,
100000000000000,
1000000000000000,
10000000000000000,
100000000000000000,
1000000000000000000,
10000000000000000000
]
if n <= 19 { self.init(tens[n]) }
else if n <= 38 {
let (hi, lo) = tens[19].multipliedFullWidth(by: tens[n - 19])
self = UInt128(hi) << 64 | UInt128(lo)
}
else { fatalError() }
}
}
@available(SwiftStdlib 6.0, *)
extension Int128 {
var high: Int64 { Int64(truncatingIfNeeded: self >> 64) }
var low: UInt64 { UInt64(truncatingIfNeeded: self) }
init(tenToThe n: Int) {
self.init(bitPattern: UInt128(tenToThe: n))
}
}
Int128Tests.test("Literals") {
if #available(SwiftStdlib 6.0, *) {
expectEqual(1, UInt128(tenToThe: 0))
expectEqual(10, UInt128(tenToThe: 1))
expectEqual(100, UInt128(tenToThe: 2))
expectEqual(1000, UInt128(tenToThe: 3))
expectEqual(10000, UInt128(tenToThe: 4))
expectEqual(100000, UInt128(tenToThe: 5))
expectEqual(1000000, UInt128(tenToThe: 6))
expectEqual(10000000, UInt128(tenToThe: 7))
expectEqual(100000000, UInt128(tenToThe: 8))
expectEqual(1000000000, UInt128(tenToThe: 9))
expectEqual(10000000000, UInt128(tenToThe: 10))
expectEqual(100000000000, UInt128(tenToThe: 11))
expectEqual(1000000000000, UInt128(tenToThe: 12))
expectEqual(10000000000000, UInt128(tenToThe: 13))
expectEqual(100000000000000, UInt128(tenToThe: 14))
expectEqual(1000000000000000, UInt128(tenToThe: 15))
expectEqual(10000000000000000, UInt128(tenToThe: 16))
expectEqual(100000000000000000, UInt128(tenToThe: 17))
expectEqual(1000000000000000000, UInt128(tenToThe: 18))
expectEqual(10000000000000000000, UInt128(tenToThe: 19))
expectEqual(100000000000000000000, UInt128(tenToThe: 20))
expectEqual(1000000000000000000000, UInt128(tenToThe: 21))
expectEqual(10000000000000000000000, UInt128(tenToThe: 22))
expectEqual(100000000000000000000000, UInt128(tenToThe: 23))
expectEqual(1000000000000000000000000, UInt128(tenToThe: 24))
expectEqual(10000000000000000000000000, UInt128(tenToThe: 25))
expectEqual(100000000000000000000000000, UInt128(tenToThe: 26))
expectEqual(1000000000000000000000000000, UInt128(tenToThe: 27))
expectEqual(10000000000000000000000000000, UInt128(tenToThe: 28))
expectEqual(100000000000000000000000000000, UInt128(tenToThe: 29))
expectEqual(1000000000000000000000000000000, UInt128(tenToThe: 30))
expectEqual(10000000000000000000000000000000, UInt128(tenToThe: 31))
expectEqual(100000000000000000000000000000000, UInt128(tenToThe: 32))
expectEqual(1000000000000000000000000000000000, UInt128(tenToThe: 33))
expectEqual(10000000000000000000000000000000000, UInt128(tenToThe: 34))
expectEqual(100000000000000000000000000000000000, UInt128(tenToThe: 35))
expectEqual(1000000000000000000000000000000000000, UInt128(tenToThe: 36))
expectEqual(10000000000000000000000000000000000000, UInt128(tenToThe: 37))
expectEqual(100000000000000000000000000000000000000, UInt128(tenToThe: 38))
expectEqual(1, Int128(tenToThe: 0))
expectEqual(10, Int128(tenToThe: 1))
expectEqual(100, Int128(tenToThe: 2))
expectEqual(1000, Int128(tenToThe: 3))
expectEqual(10000, Int128(tenToThe: 4))
expectEqual(100000, Int128(tenToThe: 5))
expectEqual(1000000, Int128(tenToThe: 6))
expectEqual(10000000, Int128(tenToThe: 7))
expectEqual(100000000, Int128(tenToThe: 8))
expectEqual(1000000000, Int128(tenToThe: 9))
expectEqual(10000000000, Int128(tenToThe: 10))
expectEqual(100000000000, Int128(tenToThe: 11))
expectEqual(1000000000000, Int128(tenToThe: 12))
expectEqual(10000000000000, Int128(tenToThe: 13))
expectEqual(100000000000000, Int128(tenToThe: 14))
expectEqual(1000000000000000, Int128(tenToThe: 15))
expectEqual(10000000000000000, Int128(tenToThe: 16))
expectEqual(100000000000000000, Int128(tenToThe: 17))
expectEqual(1000000000000000000, Int128(tenToThe: 18))
expectEqual(10000000000000000000, Int128(tenToThe: 19))
expectEqual(100000000000000000000, Int128(tenToThe: 20))
expectEqual(1000000000000000000000, Int128(tenToThe: 21))
expectEqual(10000000000000000000000, Int128(tenToThe: 22))
expectEqual(100000000000000000000000, Int128(tenToThe: 23))
expectEqual(1000000000000000000000000, Int128(tenToThe: 24))
expectEqual(10000000000000000000000000, Int128(tenToThe: 25))
expectEqual(100000000000000000000000000, Int128(tenToThe: 26))
expectEqual(1000000000000000000000000000, Int128(tenToThe: 27))
expectEqual(10000000000000000000000000000, Int128(tenToThe: 28))
expectEqual(100000000000000000000000000000, Int128(tenToThe: 29))
expectEqual(1000000000000000000000000000000, Int128(tenToThe: 30))
expectEqual(10000000000000000000000000000000, Int128(tenToThe: 31))
expectEqual(100000000000000000000000000000000, Int128(tenToThe: 32))
expectEqual(1000000000000000000000000000000000, Int128(tenToThe: 33))
expectEqual(10000000000000000000000000000000000, Int128(tenToThe: 34))
expectEqual(100000000000000000000000000000000000, Int128(tenToThe: 35))
expectEqual(1000000000000000000000000000000000000, Int128(tenToThe: 36))
expectEqual(10000000000000000000000000000000000000, Int128(tenToThe: 37))
expectEqual(100000000000000000000000000000000000000, Int128(tenToThe: 38))
expectEqual(0, UInt128.zero)
expectEqual(0xffffffffffffffff_ffffffffffffffff, UInt128.max)
expectEqual(340282366920938463463374607431768211455, UInt128.max)
expectEqual(0, Int128.zero)
expectEqual(0x7fffffffffffffff_ffffffffffffffff, Int128.max)
expectEqual(170141183460469231731687303715884105727, Int128.max)
expectEqual(-0x8000000000000000_0000000000000000, Int128.min)
expectEqual(-170141183460469231731687303715884105728, Int128.min)
}
}
@available(SwiftStdlib 6.0, *)
func testConversion(
_ input: some BinaryFloatingPoint,
_ r0: UInt128?,
exact: Bool = false,
line: UInt = #line
) {
var r1: UInt128? = nil
var r2: Int128? = nil
var r3: Int128? = nil
if let r0 {
if r0 == 0 { r1 = 0 }
if r0 <= Int128.max { r2 = Int128(bitPattern: r0) }
if r0 <= UInt128(bitPattern: Int128.max) &+ 1 {
r3 = Int128(bitPattern: 0 &- r0)
}
expectEqual(UInt128( input), r0, line: line)
if let r1 { expectEqual(UInt128(-input), r1, line: line) }
if let r2 { expectEqual( Int128( input), r2, line: line) }
if let r3 { expectEqual( Int128(-input), r3, line: line) }
}
if exact {
expectEqual(UInt128(exactly: input), r0, line: line)
expectEqual(UInt128(exactly: -input), r1, line: line)
expectEqual( Int128(exactly: input), r2, line: line)
expectEqual( Int128(exactly: -input), r3, line: line)
} else {
expectEqual(UInt128(exactly: input), nil, line: line)
expectEqual(UInt128(exactly: -input), nil, line: line)
expectEqual( Int128(exactly: input), nil, line: line)
expectEqual( Int128(exactly: -input), nil, line: line)
}
}
Int128Tests.test("Conversion from Double") {
if #available(SwiftStdlib 6.0, *) {
func testCase(
_ input: Double,
_ r0: UInt128?,
exact: Bool = false,
line: UInt = #line
) { testConversion(input, r0, exact: exact, line: line) }
testCase(.zero, 0, exact: true)
testCase(.leastNonzeroMagnitude, 0)
testCase(.leastNormalMagnitude, 0)
testCase(0x1.fffffffffffffp-1, 0)
testCase(0x1.0000000000000p0, 1, exact: true)
testCase(0x1.0000000000001p0, 1)
testCase(0x1.fffffffffffffp51, 0x000fffffffffffff)
testCase(0x1.0000000000000p52, 0x0010000000000000, exact: true)
testCase(0x1.0000000000001p52, 0x0010000000000001, exact: true)
testCase(0x1.fffffffffffffp63, 0x0000000000000000_fffffffffffff800, exact: true)
testCase(0x1.0000000000000p64, 0x0000000000000001_0000000000000000, exact: true)
testCase(0x1.0000000000001p64, 0x0000000000000001_0000000000001000, exact: true)
testCase(0x1.fffffffffffffp115, 0x000fffffffffffff_8000000000000000, exact: true)
testCase(0x1.0000000000000p116, 0x0010000000000000_0000000000000000, exact: true)
testCase(0x1.0000000000001p116, 0x0010000000000001_0000000000000000, exact: true)
testCase(0x1.fffffffffffffp126, 0x7ffffffffffffc00_0000000000000000, exact: true)
testCase(0x1.0000000000000p127, 0x8000000000000000_0000000000000000, exact: true)
testCase(0x1.0000000000001p127, 0x8000000000000800_0000000000000000, exact: true)
testCase(0x1.fffffffffffffp127, 0xfffffffffffff800_0000000000000000, exact: true)
testCase(0x1.0000000000000p128, nil)
testCase(0x1.0000000000001p128, nil)
testCase(0x1.fffffffffffffp1023, nil)
testCase(.infinity, nil)
testCase(.nan, nil)
}
}
Int128Tests.test("Conversion from Float") {
if #available(SwiftStdlib 6.0, *) {
func testCase(
_ input: Float,
_ r0: UInt128?,
exact: Bool = false,
line: UInt = #line
) { testConversion(input, r0, exact: exact, line: line) }
testCase(.zero, 0, exact: true)
testCase(.leastNonzeroMagnitude, 0)
testCase(.leastNormalMagnitude, 0)
testCase(0x1.fffffep-1, 0)
testCase(0x1.000000p0, 1, exact: true)
testCase(0x1.000002p0, 1)
testCase(0x1.fffffep22, 0x00000000007fffff)
testCase(0x1.000000p23, 0x0000000000800000, exact: true)
testCase(0x1.000002p23, 0x0000000000800001, exact: true)
testCase(0x1.fffffep63, 0x0000000000000000_ffffff0000000000, exact: true)
testCase(0x1.000000p64, 0x0000000000000001_0000000000000000, exact: true)
testCase(0x1.000002p64, 0x0000000000000001_0000020000000000, exact: true)
testCase(0x1.fffffep86, 0x00000000007fffff_8000000000000000, exact: true)
testCase(0x1.000000p87, 0x0000000000800000_0000000000000000, exact: true)
testCase(0x1.000002p87, 0x0000000000800001_0000000000000000, exact: true)
testCase(0x1.fffffep126, 0x7fffff8000000000_0000000000000000, exact: true)
testCase(0x1.000000p127, 0x8000000000000000_0000000000000000, exact: true)
testCase(0x1.000002p127, 0x8000010000000000_0000000000000000, exact: true)
testCase(0x1.fffffep127, 0xffffff0000000000_0000000000000000, exact: true)
testCase(.infinity, nil)
testCase(.nan, nil)
}
}
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
Int128Tests.test("Conversion from Float16") {
if #available(SwiftStdlib 6.0, *) {
func testCase(
_ input: Float16,
_ r0: UInt128?,
exact: Bool = false,
line: UInt = #line
) { testConversion(input, r0, exact: exact, line: line) }
testCase(.zero, 0, exact: true)
testCase(.leastNonzeroMagnitude, 0)
testCase(.leastNormalMagnitude, 0)
testCase(0x1.ffcp-1, 0)
testCase(0x1.000p0, 1, exact: true)
testCase(0x1.004p0, 1)
testCase(0x1.ffcp9, 0x3ff)
testCase(0x1.000p10, 0x400, exact: true)
testCase(0x1.004p10, 0x401, exact: true)
testCase(0x1.ffcp15, 0xffe0, exact: true)
testCase(.infinity, nil)
testCase(.nan, nil)
}
}
#endif
Int128Tests.test("Conversion from integers") {
if #available(SwiftStdlib 6.0, *) {
expectEqual(Int128(truncatingIfNeeded: -1), -1)
expectEqual(Int128(truncatingIfNeeded: Int8.min), -0x80)
expectEqual(Int128(truncatingIfNeeded: Int8.max), 0x0000000000000000_000000000000007f)
expectEqual(Int128(truncatingIfNeeded: UInt8.max), 0x0000000000000000_00000000000000ff)
expectEqual(Int128(truncatingIfNeeded: Int.min), -0x8000000000000000)
expectEqual(Int128(truncatingIfNeeded: Int.max), 0x0000000000000000_7fffffffffffffff)
expectEqual(Int128(truncatingIfNeeded: UInt.max), 0x0000000000000000_ffffffffffffffff)
expectEqual(Int128(exactly: -1), -1)
expectEqual(Int128(exactly: Int8.min), -0x80)
expectEqual(Int128(exactly: Int8.max), 0x7f)
expectEqual(Int128(exactly: UInt8.max), 0xff)
expectEqual(Int128(exactly: Int.min), -0x8000000000000000)
expectEqual(Int128(exactly: Int.max), 0x7fffffffffffffff)
expectEqual(Int128(exactly: UInt.max), 0xffffffffffffffff)
expectEqual(Int128(clamping: -1), -1)
expectEqual(Int128(clamping: Int8.min), -0x80)
expectEqual(Int128(clamping: Int8.max), 0x7f)
expectEqual(Int128(clamping: UInt8.max), 0xff)
expectEqual(Int128(clamping: Int.min), -0x8000000000000000)
expectEqual(Int128(clamping: Int.max), 0x7fffffffffffffff)
expectEqual(Int128(clamping: UInt.max), 0xffffffffffffffff)
expectEqual(UInt128(truncatingIfNeeded: -1), 0xffffffffffffffff_ffffffffffffffff)
expectEqual(UInt128(truncatingIfNeeded: Int8.min), 0xffffffffffffffff_ffffffffffffff80)
expectEqual(UInt128(truncatingIfNeeded: Int8.max), 0x0000000000000000_000000000000007f)
expectEqual(UInt128(truncatingIfNeeded: UInt8.max),0x0000000000000000_00000000000000ff)
expectEqual(UInt128(truncatingIfNeeded: Int.min), 0xffffffffffffffff_8000000000000000)
expectEqual(UInt128(truncatingIfNeeded: Int.max), 0x0000000000000000_7fffffffffffffff)
expectEqual(UInt128(truncatingIfNeeded: UInt.max), 0x0000000000000000_ffffffffffffffff)
expectEqual(UInt128(exactly: -1), nil)
expectEqual(UInt128(exactly: Int8.min), nil)
expectEqual(UInt128(exactly: Int8.max), 0x7f)
expectEqual(UInt128(exactly: UInt8.max), 0xff)
expectEqual(UInt128(exactly: Int.min), nil)
expectEqual(UInt128(exactly: Int.max), 0x7fffffffffffffff)
expectEqual(UInt128(exactly: UInt.max), 0xffffffffffffffff)
expectEqual(UInt128(clamping: -1), 0)
expectEqual(UInt128(clamping: Int8.min), 0)
expectEqual(UInt128(clamping: Int8.max), 0x7f)
expectEqual(UInt128(clamping: UInt8.max),0xff)
expectEqual(UInt128(clamping: Int.min), 0)
expectEqual(UInt128(clamping: Int.max), 0x7fffffffffffffff)
expectEqual(UInt128(clamping: UInt.max), 0xffffffffffffffff)
}
}
Int128Tests.test("Bytes and words") {
if #available(SwiftStdlib 6.0, *) {
let ascending: Int128 = 0x0f0e0d0c0b0a09080706050403020100
let descending: Int128 = 0x000102030405060708090a0b0c0d0e0f
expectEqual(ascending.byteSwapped, descending)
#if _endian(little)
expectEqual(ascending.littleEndian, ascending)
expectEqual(ascending.bigEndian, descending)
#else
expectEqual(ascending.littleEndian, descending)
expectEqual(ascending.bigEndian, ascending)
#endif
#if _pointerBitWidth(_32)
expectEqual(ascending.words[0], 0x03020100)
expectEqual(ascending.words[3], 0x0f0e0d0c)
#else
expectEqual(ascending.words[0], 0x0706050403020100)
expectEqual(ascending.words[1], 0x0f0e0d0c0b0a0908)
#endif
}
}
Int128Tests.test("Bitwise operations") {
if #available(SwiftStdlib 6.0, *) {
let a: UInt128 = 0xffff0000ffff0000_ffff0000ffff0000
let b: UInt128 = 0xf0e0d0c0b0a09080_7060504030201000
expectEqual(~a, 0x0000ffff0000ffff_0000ffff0000ffff)
expectEqual(~b, 0x0f1f2f3f4f5f6f7f_8f9fafbfcfdfefff)
expectEqual(a & b, 0xf0e00000b0a00000_7060000030200000)
expectEqual(a | b, 0xffffd0c0ffff9080_ffff5040ffff1000)
expectEqual(a ^ b, 0x0f1fd0c04f5f9080_8f9f5040cfdf1000)
expectEqual(a &>> 0, a)
expectEqual(a &>> 1, 0x7fff80007fff8000_7fff80007fff8000)
expectEqual(a &>> 2, 0x3fffc0003fffc000_3fffc0003fffc000)
expectEqual(a &>> 3, 0x1fffe0001fffe000_1fffe0001fffe000)
expectEqual(a &>> 4, 0x0ffff0000ffff000_0ffff0000ffff000)
expectEqual(b &>> 8, 0x00f0e0d0c0b0a090_8070605040302010)
expectEqual(b &>> 16, 0x0000f0e0d0c0b0a0_9080706050403020)
expectEqual(b &>> 32, 0x00000000f0e0d0c0_b0a0908070605040)
expectEqual(b &>> 64, 0x0000000000000000_f0e0d0c0b0a09080)
expectEqual(b &>> 127, 0x0000000000000000_0000000000000001)
expectEqual(b &>> 128, b)
expectEqual(a &<< 0, a)
expectEqual(a &<< 1, 0xfffe0001fffe0001_fffe0001fffe0000)
expectEqual(a &<< 2, 0xfffc0003fffc0003_fffc0003fffc0000)
expectEqual(a &<< 3, 0xfff80007fff80007_fff80007fff80000)
expectEqual(a &<< 4, 0xfff0000ffff0000f_fff0000ffff00000)
expectEqual(b &<< 8, 0xe0d0c0b0a0908070_6050403020100000)
expectEqual(b &<< 16, 0xd0c0b0a090807060_5040302010000000)
expectEqual(b &<< 32, 0xb0a0908070605040_3020100000000000)
expectEqual(b &<< 64, 0x7060504030201000_0000000000000000)
expectEqual(b &<< 127, 0x0000000000000000_0000000000000000)
expectEqual(b &<< 128, b)
expectEqual(a.nonzeroBitCount, 64)
expectEqual(b.nonzeroBitCount, 32)
for i in 0 ..< 128 {
expectEqual((a >> i).leadingZeroBitCount, i)
expectEqual((~a << i).trailingZeroBitCount, i)
}
}
}
Int128Tests.test("Addition and subtraction") {
if #available(SwiftStdlib 6.0, *) {
func testCase(
_ a: UInt128,
_ b: UInt128,
_ r: UInt128,
_ c: Bool,
line: UInt = #line
) {
expectEqual(a.addingReportingOverflow(b), (r, c), line: line)
expectEqual(r.subtractingReportingOverflow(b), (a, c), line: line)
expectEqual(a &+ b, r, line: line)
expectEqual(r &- b, a, line: line)
if !c {
expectEqual(a + b, r, line: line)
expectEqual(r - b, a, line: line)
}
let sa = Int128(bitPattern: a)
let sb = Int128(bitPattern: b)
let sr = Int128(bitPattern: r)
let o = (sr < sa) != (sb < 0)
expectEqual(sa.addingReportingOverflow(sb), (sr, o), line: line)
expectEqual(sr.subtractingReportingOverflow(sb), (sa, o), line: line)
expectEqual(sa &+ sb, sr, line: line)
expectEqual(sr &- sb, sa, line: line)
if !o {
expectEqual(sa + sb, sr, line: line)
expectEqual(sr - sb, sa, line: line)
}
}
testCase(0x22cece8fc3a992208da8556f20cd17b4, 0x5bf62486bf4d907e675fa524340e9d5a, 0x7ec4f31682f7229ef507fa9354dbb50e, false)
testCase(0xe9584e473c12b6939c5082bc1a6fefb8, 0xff05d7ed3e790d90d5ef9ebcb73d9069, 0xe85e26347a8bc42472402178d1ad8021, true)
testCase(0x7a798c5a2be3c25d535afa5034515452, 0x0d0ace9628ab60f1daf587b6b67c955c, 0x87845af0548f234f2e508206eacde9ae, false)
testCase(0xc705e6d4914456f1f2d06da52636e43f, 0xbbe6d539ab4547db2ad744ed53397a35, 0x82ecbc0e3c899ecd1da7b29279705e74, true)
testCase(0xf430bcb091f4ef9a4d85491e20ba04f8, 0x926a7b2ac49990b5199158bad743b159, 0x869b37db568e804f6716a1d8f7fdb651, true)
testCase(0xb60e3a058cd6e09533e5e033531cfd51, 0xdb158676610e7781644a11bbbaad0d4b, 0x9123c07bede55816982ff1ef0dca0a9c, true)
testCase(0xfa89a0decc7cd118ac1d6dc1c2a5551e, 0x4c7b749f2026fb70073991476ae8b14b, 0x4705157deca3cc88b356ff092d8e0669, true)
testCase(0x28cf1805ce5619540dc3865f3333a1c7, 0x4540a2f2904597acb76aad187dd2bd8c, 0x6e0fbaf85e9bb100c52e3377b1065f53, false)
testCase(0xfdcdfed4461bb6b5a2f9e820c942a23e, 0x56dbb5736acdf88a7ec689411190b1ee, 0x54a9b447b0e9af4021c07161dad3542c, true)
testCase(0x7bbaa57afd5f00ab23217777a34a1aeb, 0xc4e44711b56b4225de042bfca852ce05, 0x409eec8cb2ca42d10125a3744b9ce8f0, true)
testCase(0x1b7c7c6a905f48c0a75bf01a4dba2b15, 0x939db97340982bf994095590073c0273, 0xaf1a35ddd0f774ba3b6545aa54f62d88, false)
testCase(0xdedff2c264dfccd2911a30751905e0f1, 0x251cb12e47c0e6549816bc8f56a7de47, 0x03fca3f0aca0b3272930ed046fadbf38, true)
testCase(0x9f6673d7eb5c5d20be751255bfd8aab6, 0x03063926cb83f35999f2b84fec4c75a6, 0xa26cacfeb6e0507a5867caa5ac25205c, false)
testCase(0x64946c1e78af2b998861717ca84635a7, 0x41a8c07dd680babe0dc1cc2895f8743d, 0xa63d2c9c4f2fe65796233da53e3ea9e4, false)
testCase(0x1b6a36a075037a69d0801fc3370f7d0c, 0x243d24a92779ca04e96bebe55f4cf489, 0x3fa75b499c7d446eb9ec0ba8965c7195, false)
testCase(0xbd30fd9f09cc20a80b6bd90d4d56a816, 0x1767f07efe015f0f848325a5efe2ccb0, 0xd498ee1e07cd7fb78feefeb33d3974c6, false)
}
}
Int128Tests.test("Wide multiplication and division") {
if #available(SwiftStdlib 6.0, *) {
func testCase(
_ a: UInt128,
_ b: UInt128,
_ h: UInt128,
_ l: UInt128,
line: UInt = #line
) {
expectEqual(a.multipliedFullWidth(by: b), (h, l), line: line)
expectEqual(a &* b, l, line: line)
expectEqual(a.dividingFullWidth((high: h, low: l)), (b, 0), line: line)
let (l1, c) = l.addingReportingOverflow(a &- 1)
let h1 = h &+ (c ? 1 : 0)
expectEqual(a.dividingFullWidth((high: h1, low: l1)), (b, a &- 1), line: line)
let sa = Int128(bitPattern: a)
let sb = Int128(bitPattern: b)
let sh = Int128(bitPattern: h) &- (sa < 0 ? sb : 0) &- (sb < 0 ? sa : 0)
expectEqual(sa.multipliedFullWidth(by: sb), (sh, l), line: line)
expectEqual(sa &* sb, Int128(bitPattern: l), line: line)
expectEqual(sa.dividingFullWidth((high: sh, low: l)), (sb, 0), line: line)
let rem = sa.magnitude &- 1
if sh < 0 {
let (l1, c) = l.subtractingReportingOverflow(rem)
let h1 = sh &- (c ? 1 : 0)
expectEqual(sa.dividingFullWidth((high: h1, low: l1)), (sb, -Int128(rem)), line: line)
} else {
let (l1, c) = l.addingReportingOverflow(rem)
let h1 = sh &+ (c ? 1 : 0)
expectEqual(sa.dividingFullWidth((high: h1, low: l1)), (sb, Int128(rem)), line: line)
}
}
testCase(0x14f6c7bb051951bc8f36082753d0ad15, 0xdba081b2a9cde4e20c6778833e3795dd, 0x11fc41b8ce63bc91660b4e6b14214280, 0xc0c6e5ba6909c6bdaf80e33b1565a421)
testCase(0x4e0d20760a881de82733cea44f83b686, 0xff6f66e9e75392e824ff2eca4b114ad4, 0x4de10a6733150dc755f9f237e920c12d, 0x2d3e5a1b8508cace5d0b97024cbbe2f8)
testCase(0x2e79ffe8593c337e6711ce338d24e68e, 0x0865ae2d496547bef886cbd8cd01a507, 0x018645c05e2a2bfc986d97269c67548c, 0x2d7cc7781078868df9e718f64129d3e2)
testCase(0xb87ba0a48cef1ec31e29e9fdcfe2df98, 0x9562e44cdf7d2b477a13fab32c518a8a, 0x6ba73858c5d9434d32fe784903ab229f, 0x1f3fad1dd5d313f4760981613bec77f0)
testCase(0x9e592a6a645a5a122f2d8d91f0fd4a41, 0xe47f8b71ee5f8d6dcd106a0a948cd06c, 0x8d564e43aefdbe7ee9c60f4be7a313fd, 0x7ff590f409e22d36b114575ba6bc236c)
testCase(0x9b729e658174948344571ef72b076a27, 0x6974e6724777c407350cee21ff34c571, 0x4008fed5c6d6b87d6f8fe810feb01738, 0xbeb752f23799535430d2f07c1be1de37)
testCase(0xba8a7af31e765b55d6c25fe76afa6e07, 0x0be8692c259620beb17be8b4841dfda6, 0x08ad4d6ad640f33caf27840505980f1d, 0x7618d3e7bfedd9a16b5ad8ceefeb438a)
testCase(0xe5cd79731d8679e5e42ec8202a94d8dc, 0xa6ce214fa3403650c9e18694a06cda68, 0x95bc45ff5962bf0a20cb37f6e1f43e74, 0xc994fba22acbcb3eee8836d909f37160)
testCase(0xeb220b552e8fe3f9b132220667a22feb, 0x0becf5688f15a28f25a35c735a84dec7, 0x0af41b46b9a01f0b0d307b1f8fdd81ce, 0xa11503513c983a2753eb6fe387cd09ad)
testCase(0x5d169627de62266ddbc59265a154a308, 0x42ca365c49a2c5e15014254b2152a827, 0x18495a4d155bc7a7f7e315f7c6bdaa0d, 0x43ba59ef45fee3ccdd8180d35f721638)
testCase(0x74c28baa7abcef0ea57e0c83cc235eeb, 0xc2cd3db0b1fda551418574c229518cf8, 0x58d909c3fabd4d2348cc26c441ee3ee9, 0x8108c4836103e2ca0740decbc58777a8)
testCase(0x9fc1c89a4461a31e84eb3efe62d99eb8, 0x82c936fe8a96d4875ffb2b24b3994035, 0x519df95690eb6f4aac34ff7f7962ce45, 0x8a1753bb4bf2aade34461b4b62b3dc18)
testCase(0xa98fd77674c6933fd8092428742d1365, 0x7dc38f365a41e190913d42048216dce3, 0x534cc3a14fbabc0c6bde9041864620cf, 0xa324e403eec48789556c0b02b550fe8f)
testCase(0x970ec5575cbe7d2ce36963a03c8c9b67, 0x4bcad32daf8b4d550ee233b364ca5c48, 0x2cb9021470effa54bb93f9e9ecdafef2, 0x8fdbf661c079405b35bc7c7f6aaab8f8)
testCase(0x7600cffa32b6e9cf26b67a223ef199f0, 0x81dde6c0a4c20f27f46bee142b5d1d3b, 0x3bdcb1de25f4b1c5f4a752037488e46d, 0x3b388b97a7358b645634a0661c4eaa50)
testCase(0x66bf68e43bb06f1518298f5b3f44dfd2, 0x2aae55e5a54ca26fb9065285487add11, 0x11215fc8765040c025ded1c61f6bf4e2, 0xce48257020acb07866315c8d62df26f2)
}
}
Int128Tests.test("Narrow multiplication and division") {
if #available(SwiftStdlib 6.0, *) {
func testCase(
_ a: UInt128,
_ b: UInt128,
_ q: UInt128,
_ r: UInt128,
line: UInt = #line
) {
expectEqual(a, b*q + r, line: line)
expectEqual(a, b&*q &+ r, line: line)
expectEqual(q, a/b, line: line)
expectEqual(r, a%b, line: line)
expectEqual((q,r), a.quotientAndRemainder(dividingBy: b), line: line)
for sgn in 0 ..< 4 {
let sa = (sgn & 1 == 0 ? 1 : -1) * Int128(bitPattern: a)
let sb = (sgn & 2 == 0 ? 1 : -1) * Int128(bitPattern: b)
let sq = (sgn == 0 || sgn == 3 ? 1 : -1) * Int128(bitPattern: q)
let sr = (sgn & 1 == 0 ? 1 : -1) * Int128(bitPattern: r)
expectEqual(sa, sb*sq + sr, line: line)
expectEqual(sa, sb&*sq &+ sr, line: line)
expectEqual(sq, sa/sb, line: line)
expectEqual(sr, sa%sb, line: line)
expectEqual((sq,sr), sa.quotientAndRemainder(dividingBy: sb), line: line)
}
}
testCase(0x2d, 0x1, 0x2d, 0x0)
testCase(0x809b, 0x3f, 0x20a, 0x25)
testCase(0x1ffe1f, 0xb73df, 0x2, 0x91661)
testCase(0x6b324345, 0x2ff256, 0x23c, 0x10cb1d)
testCase(0x8b1339b357, 0x31e, 0x2c9d960a, 0x2b)
testCase(0x2517b04df6ce, 0x23abc4a, 0x10a33c, 0x6b776)
testCase(0x21e7e8fa820294, 0x880fb, 0x3fcb4bafa, 0x1af76)
testCase(0xde4770ddf9e0f3d3, 0x65af7, 0x22f9a7842600, 0x449d3)
testCase(0x33f29c91b6bc266b83, 0xc7, 0x42d3c2fbc5c50466, 0x39)
testCase(0xc5b6d1764958768637e9, 0x1a, 0x79ab94978f98e679fb0, 0x9)
testCase(0x45b7f2f79a6d80e6c51aca, 0x16322b389a60ca4, 0x3241b89a, 0x8e20ef8227a022)
testCase(0x917f58ede4323d3ba84bd18d, 0x604e0, 0x182c40337c3375ba4a05, 0x4f92d)
testCase(0x82f81933bff7f5eac96a153a7d, 0x5dfd04eff918d9c8e73bc217, 0x164, 0x443e560991670f67dafb5281)
testCase(0x1c2f66fc69f41900b99513223c17, 0x958363a31680f9c30, 0x3042609f065, 0x844cb780cc4dc9d27)
testCase(0x35fd60b643a620e916d79ed68f6456, 0x7ecdc2aa76f2b195896e3a0d, 0x6cff88, 0x442240b30e2e91c88ab19a6e)
testCase(0x4e1d078976ed907b2b06ec3ab6c09750, 0x17, 0x3656fa1cd84c37fca37f4028d82ceed, 0x5)
}
}
Int128Tests.test("String roundtrip") {
if #available(SwiftStdlib 6.0, *) {
let values: [UInt128] = [
0x8000ffff0000ffff_0000ffff0000ffff,
0x80f0e0d0c0b0a090_8070605040302010,
0x0000000000000000_ffffffffffffffff,
0xffffffffffffffff_ffffffffffffffff
]
for a in values {
expectEqual(a, UInt128(String(a)))
}
for a in values.map(Int128.init(bitPattern:)) {
expectEqual(a, Int128(String(a)))
}
}
}

View File

@@ -2,7 +2,7 @@
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2023 Apple Inc. and the Swift project authors
# Copyright (c) 2023-2024 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
@@ -21,22 +21,7 @@ atomicTypes = [
("_Atomic128BitStorage", "128", "16", "Builtin.Int128", "WordPair"),
]
intTypes = [
# Swift, Storage Type, Builtin
("Int8", "_Atomic8BitStorage", "Int8"),
("Int16", "_Atomic16BitStorage", "Int16"),
("Int32", "_Atomic32BitStorage", "Int32"),
("Int64", "_Atomic64BitStorage", "Int64"),
# We handle the word type's storage in source.
("Int", "", ""),
("UInt", "", ""),
("UInt8", "_Atomic8BitStorage", "Int8"),
("UInt16", "_Atomic16BitStorage", "Int16"),
("UInt32", "_Atomic32BitStorage", "Int32"),
("UInt64", "_Atomic64BitStorage", "Int64"),
]
atomicBits = ["", "8", "16", "32", "64", "128"]
loadOrderings = [
# Swift, API name, doc name, LLVM name