SIMD module

operator-

procedure · 3 overloadsSource

Subtracts the lanes of b from those of a.

Integer lanes wrap on overflow, so unsigned lanes wrap below zero.

ExampleOpen in playground ↗
a := set(4, cast(s32) 3);
assert((a - set(4, cast(s32) 5)).data[0] == -2);
assert((a - cast(s32) 1).data[0] == 2);
assert((cast(s32) 10 - a).data[0] == 7);
operator- :: (a: $T/SIMD_Array, b: T) -> T

Subtracts the lanes of b from those of a.

Integer lanes wrap on overflow, so unsigned lanes wrap below zero.

Parameters

b: T

Returns

T
ExampleOpen in playground ↗
a := set(4, cast(s32) 3);
assert((a - set(4, cast(s32) 5)).data[0] == -2);
assert((a - cast(s32) 1).data[0] == 2);
assert((cast(s32) 10 - a).data[0] == 7);
operator- :: (a: $T/SIMD_Array, factor: a.type) -> T

Subtracts factor from every lane. The scalar can be on either side: scalar - vector subtracts every lane from the scalar.

Parameters

factor: a.type

Returns

T
operator- :: (factor: $E, a: SIMD_Array($N, E)) -> SIMD_Array(N, E)

Applies - with the scalar factor on the left: each lane of the result is factor - the lane of a.

Parameters

factor: $E
a: SIMD_Array($N, E)

Returns

See also