SIMD module

load

procedure · 1 overloadSource

Reads N lanes of type F from consecutive memory starting at base, lane 0 from the lowest address. Both the lane count and the lane type are explicit: load(pointer, 4, s32). No alignment is needed.

Reads N * size_of(F) bytes without checking that they exist; a null base fails an assert.

ExampleOpen in playground ↗
numbers: [4] s32 = .[10, 20, 30, 40];
v := load(numbers.data, 4, s32);
assert(v.data[0] == 10 && v.data[3] == 40);
load :: (base: *void, $N: int, $F: Type) -> SIMD_Array(N, F)

Reads N lanes of type F from consecutive memory starting at base, lane 0 from the lowest address. Both the lane count and the lane type are explicit: load(pointer, 4, s32). No alignment is needed.

Reads N * size_of(F) bytes without checking that they exist; a null base fails an assert.

Parameters

base: *void
$N: int
$F: Type

Returns

ExampleOpen in playground ↗
numbers: [4] s32 = .[10, 20, 30, 40];
v := load(numbers.data, 4, s32);
assert(v.data[0] == 10 && v.data[3] == 40);

See also