We already support vector bit operators, so let's test it

This commit is contained in:
Jimmi Holst Christensen 2019-02-13 11:40:32 +01:00
parent c7b9ab985c
commit 53297a1bd0

View File

@ -29,3 +29,17 @@ test "vector float operators" {
S.doTheTest();
comptime S.doTheTest();
}
test "vector bit operators" {
const S = struct {
fn doTheTest() void {
const v: @Vector(4, u8) = [4]u8{ 0b10101010, 0b10101010, 0b10101010, 0b10101010 };
const x: @Vector(4, u8) = [4]u8{ 0b11110000, 0b00001111, 0b10101010, 0b01010101 };
expect(mem.eql(u8, ([4]u8)(v ^ x), [4]u8{ 0b01011010, 0b10100101, 0b00000000, 0b11111111 }));
expect(mem.eql(u8, ([4]u8)(v | x), [4]u8{ 0b11111010, 0b10101111, 0b10101010, 0b11111111 }));
expect(mem.eql(u8, ([4]u8)(v & x), [4]u8{ 0b10100000, 0b00001010, 0b10101010, 0b00000000 }));
}
};
S.doTheTest();
comptime S.doTheTest();
}