Skip to content

Commit 7627319

Browse files
committed
Force specialization of a very big function quotientAndRemainder for the most popular values of generic type parameters.
This reduces the amount of work to be done on the client side, because specializations from the stdlib can be used there.
1 parent 317e681 commit 7627319

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

stdlib/public/core/DoubleWidth.swift.gyb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
297297
return (result, didCarry || hadPositiveOverflow)
298298
}
299299

300+
// Specialize for the most popular types.
301+
@_specialize(where Base == Int)
302+
@_specialize(where Base == UInt)
303+
@_specialize(where Base == Int64)
304+
@_specialize(where Base == UInt64)
300305
public func quotientAndRemainder(dividingBy other: DoubleWidth)
301306
-> (quotient: DoubleWidth, remainder: DoubleWidth) {
302307
let isNegative = (self < (0 as DoubleWidth)) != (other < (0 as DoubleWidth))

0 commit comments

Comments
 (0)