SIMD module

store_with_offsets

procedure · 1 overloadSource

Scatters the lanes of a to base + offsets.data[i], each offset a signed byte displacement. a and offsets must have the same lane count (checked at compile time).

Lanes are written in order, so when two offsets are equal the later lane wins. Nothing is bounds-checked; a null base fails an assert.

ExampleOpen in playground ↗
numbers: [4] s32;
values := set(2, cast(s32) 0);
values.data = .[7, 8];
offsets := set(2, cast(s64) 0);
offsets.data = .[8, 0];
store_with_offsets(values, numbers.data, offsets);
assert(numbers[2] == 7 && numbers[0] == 8);
store_with_offsets :: (a: $T/SIMD_Array, base: *void, offsets: $O/SIMD_Array)

Scatters the lanes of a to base + offsets.data[i], each offset a signed byte displacement. a and offsets must have the same lane count (checked at compile time).

Lanes are written in order, so when two offsets are equal the later lane wins. Nothing is bounds-checked; a null base fails an assert.

Parameters

base: *void
offsets: $O/SIMD_Array
ExampleOpen in playground ↗
numbers: [4] s32;
values := set(2, cast(s32) 0);
values.data = .[7, 8];
offsets := set(2, cast(s64) 0);
offsets.data = .[8, 0];
store_with_offsets(values, numbers.data, offsets);
assert(numbers[2] == 7 && numbers[0] == 8);

See also