mirror of
https://github.com/apple/swift-atomics
synced 2026-11-28 04:54:21 +00:00
Move definition of DoubleWord into DoubleWord.swift
This commit is contained in:
3 files changed
+56
-99
No files matched your search
@@ -18,57 +18,9 @@ ${autogenerated_warning()}
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
import Builtin
|
||||
|
||||
#if ${ptrBitWidth32}
|
||||
@frozen
|
||||
@_alignment(8)
|
||||
public struct DoubleWord {
|
||||
@usableFromInline
|
||||
internal typealias _Builtin = Builtin.Int64
|
||||
|
||||
public var first: UInt
|
||||
public var second: UInt
|
||||
|
||||
@inlinable @inline(__always)
|
||||
public init(first: UInt, second: UInt) {
|
||||
self.first = first
|
||||
self.second = second
|
||||
}
|
||||
}
|
||||
#else
|
||||
@frozen
|
||||
@_alignment(16)
|
||||
public struct DoubleWord {
|
||||
@usableFromInline
|
||||
internal typealias _Builtin = Builtin.Int128
|
||||
|
||||
public var first: UInt
|
||||
public var second: UInt
|
||||
|
||||
@inlinable @inline(__always)
|
||||
public init(first: UInt, second: UInt) {
|
||||
self.first = first
|
||||
self.second = second
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension DoubleWord {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
internal init(_ builtin: _Builtin) {
|
||||
self = unsafeBitCast(builtin, to: DoubleWord.self)
|
||||
}
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
internal var _value: _Builtin {
|
||||
unsafeBitCast(self, to: _Builtin.self)
|
||||
}
|
||||
}
|
||||
|
||||
extension Bool {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
@_transparent
|
||||
internal init(_ builtin: Builtin.Int1) {
|
||||
self = unsafeBitCast(builtin, to: Bool.self)
|
||||
}
|
||||
|
||||
@@ -21,57 +21,9 @@
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
import Builtin
|
||||
|
||||
#if (compiler(>=5.9) && _pointerBitWidth(_32)) || (compiler(<5.9) && (arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32)))
|
||||
@frozen
|
||||
@_alignment(8)
|
||||
public struct DoubleWord {
|
||||
@usableFromInline
|
||||
internal typealias _Builtin = Builtin.Int64
|
||||
|
||||
public var first: UInt
|
||||
public var second: UInt
|
||||
|
||||
@inlinable @inline(__always)
|
||||
public init(first: UInt, second: UInt) {
|
||||
self.first = first
|
||||
self.second = second
|
||||
}
|
||||
}
|
||||
#else
|
||||
@frozen
|
||||
@_alignment(16)
|
||||
public struct DoubleWord {
|
||||
@usableFromInline
|
||||
internal typealias _Builtin = Builtin.Int128
|
||||
|
||||
public var first: UInt
|
||||
public var second: UInt
|
||||
|
||||
@inlinable @inline(__always)
|
||||
public init(first: UInt, second: UInt) {
|
||||
self.first = first
|
||||
self.second = second
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
extension DoubleWord {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
internal init(_ builtin: _Builtin) {
|
||||
self = unsafeBitCast(builtin, to: DoubleWord.self)
|
||||
}
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
internal var _value: _Builtin {
|
||||
unsafeBitCast(self, to: _Builtin.self)
|
||||
}
|
||||
}
|
||||
|
||||
extension Bool {
|
||||
@_alwaysEmitIntoClient
|
||||
@inline(__always)
|
||||
@_transparent
|
||||
internal init(_ builtin: Builtin.Int1) {
|
||||
self = unsafeBitCast(builtin, to: Bool.self)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,60 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if !ATOMICS_NATIVE_BUILTINS
|
||||
#if ATOMICS_NATIVE_BUILTINS
|
||||
import Builtin
|
||||
|
||||
#if _pointerBitWidth(_32)
|
||||
@frozen
|
||||
@_alignment(8)
|
||||
public struct DoubleWord {
|
||||
@usableFromInline
|
||||
internal typealias _Builtin = Builtin.Int64
|
||||
|
||||
public var first: UInt
|
||||
public var second: UInt
|
||||
|
||||
@inlinable @inline(__always)
|
||||
public init(first: UInt, second: UInt) {
|
||||
self.first = first
|
||||
self.second = second
|
||||
}
|
||||
}
|
||||
#elseif _pointerBitWidth(_64)
|
||||
@frozen
|
||||
@_alignment(16)
|
||||
public struct DoubleWord {
|
||||
@usableFromInline
|
||||
internal typealias _Builtin = Builtin.Int128
|
||||
|
||||
public var first: UInt
|
||||
public var second: UInt
|
||||
|
||||
@inlinable @inline(__always)
|
||||
public init(first: UInt, second: UInt) {
|
||||
self.first = first
|
||||
self.second = second
|
||||
}
|
||||
}
|
||||
#else
|
||||
#error("Unexpected pointer bit width")
|
||||
#endif
|
||||
|
||||
extension DoubleWord {
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal init(_ builtin: _Builtin) {
|
||||
self = unsafeBitCast(builtin, to: DoubleWord.self)
|
||||
}
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
@_transparent
|
||||
internal var _value: _Builtin {
|
||||
unsafeBitCast(self, to: _Builtin.self)
|
||||
}
|
||||
}
|
||||
|
||||
#else // !ATOMICS_NATIVE_BUILTINS
|
||||
import _AtomicsShims
|
||||
public typealias DoubleWord = _AtomicsShims.DoubleWord
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user