SIMD module

get_looping_indices

procedure · 1 overloadSource

Returns N lanes of type I holding 0, STEP, 2 * STEP, ...: lane i is i * STEP. STEP can be negative. Useful as the offsets of a gather or scatter. N must be positive.

ExampleOpen in playground ↗
indices := get_looping_indices(4, s32);
assert(indices.data[0] == 0 && indices.data[3] == 3);
stepped := get_looping_indices(4, s32, 3);
assert(stepped.data[2] == 6);
get_looping_indices :: ($N: int, $I: Type, $STEP := 1) -> SIMD_Array(N, I)

Returns N lanes of type I holding 0, STEP, 2 * STEP, ...: lane i is i * STEP. STEP can be negative. Useful as the offsets of a gather or scatter. N must be positive.

Parameters

$N: int
$I: Type
$STEP := 1

Returns

ExampleOpen in playground ↗
indices := get_looping_indices(4, s32);
assert(indices.data[0] == 0 && indices.data[3] == 3);
stepped := get_looping_indices(4, s32, 3);
assert(stepped.data[2] == 6);

See also