Hi! :D
I have a vector of indexes into an array and I would like to turn that vector of indexes into a vector of the associated values from some array like this:
const std = @import("std");
const assert = std.debug.assert;
pub fn main() !void {
var arr = [_]i32{ 1, 2, 3, 4, 5, 6, 7 };
var a = @Vector(4, i32){ 6, 2, 0, 4 };
var b: @Vector(4, i32) = arr[a];
assert(b == @Vector(4, i32){ 7, 3, 1, 5 });
}
Is is possible? would there be a benefit from a doing this instead of some non-vectorized manual load?
The usecase is getting piece types from a the board in my chess engine btw: I have ~16 to ~64 square indexes that I need to turn into piece types (enum) before doing move ordering and I thought that loading the piece types in bulk like this would be faster than just some loop.
Thanks for any help :D