Skip to content

[Foundation] Fallback to presuming 32-bit platforms if we dont explicitly know that it is 64 bit; this allows for better portability #21290

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions stdlib/public/Darwin/Foundation/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -683,15 +683,15 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
@usableFromInline
typealias Buffer = (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8,
UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) //len //enum
@usableFromInline
var bytes: Buffer
#elseif arch(i386) || arch(arm)
#elseif arch(i386) || arch(arm) || arch(arm64_32)
@usableFromInline
typealias Buffer = (UInt8, UInt8, UInt8, UInt8,
UInt8, UInt8) //len //enum
#else
#error ("Unsupported architecture: a definition of Buffer needs to be made with N = (MemoryLayout<(Int, Int)>.size - 2) UInt8 members to a tuple")
#endif
@usableFromInline
var bytes: Buffer
#endif
@usableFromInline
var length: UInt8

Expand Down Expand Up @@ -720,9 +720,11 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
assert(count <= MemoryLayout<Buffer>.size)
#if arch(x86_64) || arch(arm64) || arch(s390x) || arch(powerpc64) || arch(powerpc64le)
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))
#elseif arch(i386) || arch(arm)
#elseif arch(i386) || arch(arm) || arch(arm64_32)
bytes = (UInt8(0), UInt8(0), UInt8(0), UInt8(0),
UInt8(0), UInt8(0))
#else
#error ("Unsupported architecture: initialization for Buffer is required for this architecture")
#endif
length = UInt8(count)
}
Expand Down Expand Up @@ -878,9 +880,11 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
#if arch(x86_64) || arch(arm64) || arch(s390x) || arch(powerpc64) || arch(powerpc64le)
@usableFromInline
internal typealias HalfInt = Int32
#elseif arch(i386) || arch(arm)
#elseif arch(i386) || arch(arm) || arch(arm64_32)
@usableFromInline
internal typealias HalfInt = Int16
#else
#error ("Unsupported architecture: a definition of half of the pointer sized Int needs to be defined for this architecture")
#endif

@usableFromInline
Expand Down