Skip to content

Commit 97adda9

Browse files
Use the blessed (repeating: Scalar) init instead of (Scalar) in simd. (#23534) (#23552)
1 parent 356b87a commit 97adda9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

stdlib/public/Darwin/simd/simd.swift.gyb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ public func max(_ x: ${vectype}, _ y: ${vectype}) -> ${vectype} {
9090
/// corresponding element of the input vector and the scalar.
9191
@_transparent
9292
public func min(_ vector: ${vectype}, _ scalar: ${scalar}) -> ${vectype} {
93-
return min(vector, ${vectype}(scalar))
93+
return min(vector, ${vectype}(repeating: scalar))
9494
}
9595
9696
/// Vector-scalar maximum. Each component of the result is the maximum of the
9797
/// corresponding element of the input vector and the scalar.
9898
@_transparent
9999
public func max(_ vector: ${vectype}, _ scalar: ${scalar}) -> ${vectype} {
100-
return max(vector, ${vectype}(scalar))
100+
return max(vector, ${vectype}(repeating: scalar))
101101
}
102102
103103
/// Each component of the result is the corresponding element of `x` clamped to
@@ -374,7 +374,7 @@ extension ${mattype} {
374374
375375
/// Initialize matrix to have `scalar` on main diagonal, zeros elsewhere.
376376
public init(_ scalar: ${type}) {
377-
self.init(diagonal: ${diagtype}(scalar))
377+
self.init(diagonal: ${diagtype}(repeating: scalar))
378378
}
379379
380380
/// Initialize matrix to have specified `diagonal`, and zeros elsewhere.

0 commit comments

Comments
 (0)