Skip to content

Commit 0707ca6

Browse files
Remove concrete floating-point inits from integer types (#19624)
Also removes .gyb from FloatingPoint.swift, since we barely are using it after this change. Rework Self._convert from integer, by making it require RawSignificand: FixedWidthInteger. This requirement should have always been there, and the existing implementaiton wouldn't have actually worked correctly without it. Making it explcit makes the implementation quite a bit simpler, which is nice. Additionally add a fast-path conversion that will catch all concrete integer types without needing to be a concrete implementation itself. Room for further improvement, but good start. See RandomDouble performance improvements, for example.
1 parent d2f556d commit 0707ca6

File tree

5 files changed

+223
-212
lines changed

5 files changed

+223
-212
lines changed

stdlib/public/SDK/CoreGraphics/CGFloat.swift.gyb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ public struct CGFloat {
5656
self.native = value.native
5757
}
5858

59-
% for src_ty in all_integer_types(word_bits):
60-
@_transparent public init(_ value: ${src_ty.stdlib_name}) {
61-
self.native = NativeType(value)
62-
}
63-
64-
% end
65-
6659
/// The native value.
6760
public var native: NativeType
6861
}

stdlib/public/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ set(SWIFTLIB_ESSENTIAL
6666
FixedArray.swift.gyb
6767
FlatMap.swift
6868
Flatten.swift
69-
FloatingPoint.swift.gyb
69+
FloatingPoint.swift
7070
FloatingPointParsing.swift.gyb
7171
FloatingPointTypes.swift.gyb
7272
Hashable.swift

0 commit comments

Comments
 (0)