SIMD module

max

procedure · 2 overloadsSource

The lane-wise larger of two vectors. Each lane is Basic.max of the two values, so with a NaN lane the answer depends on the operand order, as it does in scalar code.

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

The lane-wise larger of two vectors. Each lane is Basic.max of the two values, so with a NaN lane the answer depends on the operand order, as it does in scalar code.

Parameters

b: T

Returns

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

The lane-wise larger of each lane and factor. Each lane is Basic.max of the two values, so with a NaN lane the answer depends on the operand order, as it does in scalar code.

Parameters

factor: a.type

Returns

T

See also