SIMD module

operator==

procedure · 2 overloadsSource

Compares lane by lane: each lane of the result is 1 where the lane of a is equal to the lane of b, else 0 (1.0 and 0.0 for float lanes). The result has the type of the operands, not bool, and is not an all-ones mask; pass it to get_mask to get one bit per lane.

ExampleOpen in playground ↗
a := set(4, cast(s32) 3);
b := a;
b.data[2] = 9;
same := a == b;
assert(same.data[0] == 1 && same.data[2] == 0);
assert(get_mask(a < b) == 4);
assert(get_mask(a == cast(s32) 3) == 15);

For float lanes a NaN is unequal to everything, itself included, as in scalar code.

operator== :: (a: $T/SIMD_Array, b: T) -> T

Compares lane by lane: each lane of the result is 1 where the lane of a is equal to the lane of b, else 0 (1.0 and 0.0 for float lanes). The result has the type of the operands, not bool, and is not an all-ones mask; pass it to get_mask to get one bit per lane.

For float lanes a NaN is unequal to everything, itself included, as in scalar code.

Parameters

b: T

Returns

T
ExampleOpen in playground ↗
a := set(4, cast(s32) 3);
b := a;
b.data[2] = 9;
same := a == b;
assert(same.data[0] == 1 && same.data[2] == 0);
assert(get_mask(a < b) == 4);
assert(get_mask(a == cast(s32) 3) == 15);
operator== :: (a: $T/SIMD_Array, factor: a.type) -> T

Compares every lane with factor: each lane of the result is 1 where the lane of a is equal to factor, else 0. The result has the type of the operands, not bool, and is not an all-ones mask; pass it to get_mask to get one bit per lane.

Parameters

factor: a.type

Returns

T

See also