Skip to content

Commit b4a4cc8

Browse files
Switch to _pointerBitWidth for architecture checks
This change switches the architecture checks in Data.swift to use the _pointerBitWidth instead of the arch() checks for consistency with newer platforms.
1 parent b747f75 commit b4a4cc8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/FoundationEssentials/Data/Data.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -582,11 +582,11 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
582582
@usableFromInline
583583
@frozen
584584
internal struct InlineData : Sendable {
585-
#if arch(x86_64) || arch(arm64) || arch(s390x) || arch(powerpc64) || arch(powerpc64le)
585+
#if _pointerBitWidth(_64)
586586
@usableFromInline typealias Buffer = (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8,
587587
UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) //len //enum
588588
@usableFromInline var bytes: Buffer
589-
#elseif arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32)
589+
#elseif _pointerBitWidth(_32)
590590
@usableFromInline typealias Buffer = (UInt8, UInt8, UInt8, UInt8,
591591
UInt8, UInt8) //len //enum
592592
@usableFromInline var bytes: Buffer
@@ -617,9 +617,9 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
617617
@inlinable // This is @inlinable as a trivial initializer.
618618
init(count: Int = 0) {
619619
assert(count <= MemoryLayout<Buffer>.size)
620-
#if arch(x86_64) || arch(arm64) || arch(s390x) || arch(powerpc64) || arch(powerpc64le)
620+
#if _pointerBitWidth(_64)
621621
bytes = (UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0))
622-
#elseif arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32)
622+
#elseif _pointerBitWidth(_32)
623623
bytes = (UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0), UInt8(0))
624624
#else
625625
#error ("Unsupported architecture: initialization for Buffer is required for this architecture")
@@ -804,9 +804,9 @@ public struct Data : Equatable, Hashable, RandomAccessCollection, MutableCollect
804804
}
805805
}
806806

807-
#if arch(x86_64) || arch(arm64) || arch(s390x) || arch(powerpc64) || arch(powerpc64le)
807+
#if _pointerBitWidth(_64)
808808
@usableFromInline internal typealias HalfInt = Int32
809-
#elseif arch(i386) || arch(arm) || arch(arm64_32) || arch(wasm32)
809+
#elseif _pointerBitWidth(_32)
810810
@usableFromInline internal typealias HalfInt = Int16
811811
#else
812812
#error ("Unsupported architecture: a definition of half of the pointer sized Int needs to be defined for this architecture")

0 commit comments

Comments
 (0)