Stdle #101 · simd · 2026-09-15
What does this Zig snippet output?
A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
const std = @import("std");pub fn main() void { const a: @Vector(4, i32) = .{ 1, 2, 3, 4 }; const b: @Vector(4, i32) = .{ 5, 6, 7, 8 }; const shuffled = @shuffle(i32, a, b, @Vector(4, i32){ 0, ~@as(i32, 1), 2, ~@as(i32, 3) }); std.debug.print("{d} {d} {d} {d}\n", .{ shuffled[0], shuffled[1], shuffled[2], shuffled[3] });}SIMD