Skip to content

Commit 0343180

Browse files
committed
Add concrete integer in-place arithmetic ops.
1 parent b428fdb commit 0343180

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

stdlib/public/core/SIMDConcreteOperations.swift.gyb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,36 @@ extension SIMD${n} where Scalar == ${Scalar} {
129129

130130
/// The wrapping sum of two vectors.
131131
@_alwaysEmitIntoClient
132-
public static func &+(a: Self, b: Self) -> Self{
132+
public static func &+(a: Self, b: Self) -> Self {
133133
Self(Builtin.add_${Builtin}(a._storage._value, b._storage._value))
134134
}
135135

136136
/// The wrapping difference of two vectors.
137137
@_alwaysEmitIntoClient
138-
public static func &-(a: Self, b: Self) -> Self{
138+
public static func &-(a: Self, b: Self) -> Self {
139139
Self(Builtin.sub_${Builtin}(a._storage._value, b._storage._value))
140140
}
141141

142142
/// The pointwise wrapping product of two vectors.
143143
@_alwaysEmitIntoClient
144-
public static func &*(a: Self, b: Self) -> Self{
144+
public static func &*(a: Self, b: Self) -> Self {
145145
Self(Builtin.mul_${Builtin}(a._storage._value, b._storage._value))
146146
}
147+
148+
/// Updates the left hand side with the wrapping sum of the two
149+
/// vectors.
150+
@_alwaysEmitIntoClient
151+
public static func &+=(a: inout Self, b: Self) { a = a &+ b }
152+
153+
/// Updates the left hand side with the wrapping difference of the two
154+
/// vectors.
155+
@_alwaysEmitIntoClient
156+
public static func &-=(a: inout Self, b: Self) { a = a &- b }
157+
158+
/// Updates the left hand side with the pointwise wrapping product of two
159+
/// vectors.
160+
@_alwaysEmitIntoClient
161+
public static func &*=(a: inout Self, b: Self) { a = a &* b }
147162
}
148163

149164
% end

0 commit comments

Comments
 (0)