SIMD module

SIMD_Array

structSource

A fixed number of lanes of one type, held in data: SIMD_Array(4, float32) is four floats in a row.

The struct is just the array, so its size is count * size_of(type) with the alignment of one lane, and data[i] is lane i. The arithmetic, comparison and memory procedures of this module take and return it; a lane is read or written through data. The lane count and type are compile-time parameters and add no runtime fields.

ExampleOpen in playground ↗
v: SIMD_Array(4, s32);
v.data = .[1, 2, 3, 4];
assert(size_of(SIMD_Array(4, s32)) == 16);
assert(horizontal_sum(v + cast(s32) 1) == 14);

Fields

data: [count] type

See also