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.
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
- SIMD_Array(N, I)
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);