Skip to content

Commit

Permalink
[Foundation] Fallback to presuming 32-bit platforms if we dont explic…
Browse files Browse the repository at this point in the history
…itly know that it is 64 bit; this allows for better portability (swiftlang#21290)
  • Loading branch information
phausler authored Dec 13, 2018
1 parent 81b5970 commit 77c7a69
Showing 1 changed file with 10 additions and 6 deletions.
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

0 comments on commit 77c7a69

Please sign in to comment.