zig/doc/langref/test_splat_builtin.zig

11 lines
256 B
Zig
Raw Normal View History

const std = @import("std");
const expect = std.testing.expect;
test "vector @splat" {
const scalar: u32 = 5;
const result: @Vector(4, u32) = @splat(scalar);
try expect(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 }));
}
// test