SIMD module

horizontal_sum

procedure · 1 overloadSource

The sum of all lanes, added in lane order from the first lane, as a single value of the lane type. Integer lanes wrap on overflow; for floats the order of addition fixes the rounding.

ExampleOpen in playground ↗
v := set(4, cast(s32) 3);
assert(horizontal_sum(v) == 12);
horizontal_sum :: (a: $T/SIMD_Array) -> a.type

The sum of all lanes, added in lane order from the first lane, as a single value of the lane type. Integer lanes wrap on overflow; for floats the order of addition fixes the rounding.

Parameters

Returns

a.type
ExampleOpen in playground ↗
v := set(4, cast(s32) 3);
assert(horizontal_sum(v) == 12);

See also