Skip to content

Commit 95309e1

Browse files
committed
Fixup Float16 availability for macCatalyst/x86_64
1 parent 88efaac commit 95309e1

9 files changed

+12
-12
lines changed

stdlib/public/core/CTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public typealias CLong = Int
5656
/// The C 'long long' type.
5757
public typealias CLongLong = Int64
5858

59-
#if !(os(macOS) && arch(x86_64))
59+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
6060
/// The C '_Float16' type.
6161
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
6262
public typealias CFloat16 = Float16

stdlib/public/core/Codable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4730,7 +4730,7 @@ extension RawRepresentable where RawValue == Float, Self: Decodable {
47304730
}
47314731
}
47324732

4733-
#if !(os(macOS) && arch(x86_64))
4733+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
47344734
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
47354735
extension Float16: Codable {
47364736
/// Creates a new instance by decoding from the given decoder.

stdlib/public/core/FloatingPoint.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,9 +1894,9 @@ extension BinaryFloatingPoint {
18941894
// count and significand bit count, then they must share the same encoding
18951895
// for finite and infinite values.
18961896
switch (Source.exponentBitCount, Source.significandBitCount) {
1897-
#if !os(macOS) && !(os(iOS) && targetEnvironment(macCatalyst))
1897+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
18981898
case (5, 10):
1899-
guard #available(iOS 14.0, watchOS 7.0, tvOS 14.0, *) else {
1899+
guard #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) else {
19001900
// Convert signaling NaN to quiet NaN by multiplying by 1.
19011901
self = Self._convert(from: value).value * 1
19021902
break

stdlib/public/core/FloatingPointParsing.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ internal func _isspace_clocale(_ u: UTF16.CodeUnit) -> Bool {
4343
% if bits == 80:
4444
#if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
4545
% elif bits == 16:
46-
#if !(os(macOS) && arch(x86_64))
46+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
4747
% end
4848

4949
%if bits == 16:

stdlib/public/core/FloatingPointTypes.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ else:
6666
% if bits == 80:
6767
#if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
6868
% elif bits == 16:
69-
#if !(os(macOS) && arch(x86_64))
69+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
7070
% end
7171

7272
${SelfDocComment}
@@ -1111,7 +1111,7 @@ extension ${Self} {
11111111
% if srcBits == 80:
11121112
#if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
11131113
% elif srcBits == 16:
1114-
#if !(os(macOS) && arch(x86_64))
1114+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
11151115
% end
11161116

11171117
% if srcBits == bits:

stdlib/public/core/IntegerTypes.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ public struct ${Self}
11301130
% if FloatType == 'Float80':
11311131
#if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
11321132
% elif FloatType == 'Float16':
1133-
#if !(os(macOS) && arch(x86_64))
1133+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
11341134
% end
11351135

11361136
/// Creates an integer from the given floating-point value, rounding toward

stdlib/public/core/Runtime.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ internal struct _Buffer72 {
293293
}
294294
}
295295

296-
#if !(os(macOS) && arch(x86_64))
296+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
297297
// Note that this takes a Float32 argument instead of Float16, because clang
298298
// doesn't have _Float16 on all platforms yet.
299299
@_silgen_name("swift_float16ToString")

stdlib/public/core/SIMDVectorTypes.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ extension ${Self}: SIMDScalar {
254254

255255
%for (Self, bits) in [('Float16',16), ('Float',32), ('Double',64)]:
256256
% if bits == 16:
257-
#if !(os(macOS) && arch(x86_64))
257+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
258258
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
259259
% end
260260
extension ${Self} : SIMDScalar {

test/stdlib/PrintFloat.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ let PrintTests = TestSuite("FloatingPointPrinting")
345345

346346
% for FloatType in ['Float16', 'Float', 'Double', 'Float80']:
347347
% if FloatType == 'Float16':
348-
#if !(os(macOS) && arch(x86_64))
348+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
349349
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
350350
% elif FloatType == 'Float80':
351351
#if !os(Windows) && (arch(i386) || arch(x86_64))
@@ -583,7 +583,7 @@ PrintTests.test("Printable_CDouble") {
583583
expectDescription("-1.0", CDouble(-1.0))
584584
}
585585

586-
#if !(os(macOS) && arch(x86_64))
586+
#if !((os(macOS) || targetEnvironment(macCatalyst)) && arch(x86_64))
587587
if #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) {
588588
PrintTests.test("Printable_Float16") {
589589
func asFloat16(_ f: Float16) -> Float16 { return f }

0 commit comments

Comments
 (0)