Skip to content

[5.1] Use the blessed (repeating: Scalar) init instead of (Scalar) in simd #23552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions stdlib/public/Darwin/simd/simd.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ public func max(_ x: ${vectype}, _ y: ${vectype}) -> ${vectype} {
/// corresponding element of the input vector and the scalar.
@_transparent
public func min(_ vector: ${vectype}, _ scalar: ${scalar}) -> ${vectype} {
return min(vector, ${vectype}(scalar))
return min(vector, ${vectype}(repeating: scalar))
}

/// Vector-scalar maximum. Each component of the result is the maximum of the
/// corresponding element of the input vector and the scalar.
@_transparent
public func max(_ vector: ${vectype}, _ scalar: ${scalar}) -> ${vectype} {
return max(vector, ${vectype}(scalar))
return max(vector, ${vectype}(repeating: scalar))
}

/// Each component of the result is the corresponding element of `x` clamped to
Expand Down Expand Up @@ -374,7 +374,7 @@ extension ${mattype} {

/// Initialize matrix to have `scalar` on main diagonal, zeros elsewhere.
public init(_ scalar: ${type}) {
self.init(diagonal: ${diagtype}(scalar))
self.init(diagonal: ${diagtype}(repeating: scalar))
}

/// Initialize matrix to have specified `diagonal`, and zeros elsewhere.
Expand Down