| ... | @@ -29,3 +29,17 @@ test "vector float operators" { | ... | @@ -29,3 +29,17 @@ test "vector float operators" { |
| 29 | S.doTheTest(); | 29 | S.doTheTest(); |
| 30 | comptime S.doTheTest(); | 30 | comptime S.doTheTest(); |
| 31 | } | 31 | } |
| | 32 | |
| | 33 | test "vector bit operators" { |
| | 34 | const S = struct { |
| | 35 | fn doTheTest() void { |
| | 36 | const v: @Vector(4, u8) = [4]u8{ 0b10101010, 0b10101010, 0b10101010, 0b10101010 }; |
| | 37 | const x: @Vector(4, u8) = [4]u8{ 0b11110000, 0b00001111, 0b10101010, 0b01010101 }; |
| | 38 | expect(mem.eql(u8, ([4]u8)(v ^ x), [4]u8{ 0b01011010, 0b10100101, 0b00000000, 0b11111111 })); |
| | 39 | expect(mem.eql(u8, ([4]u8)(v | x), [4]u8{ 0b11111010, 0b10101111, 0b10101010, 0b11111111 })); |
| | 40 | expect(mem.eql(u8, ([4]u8)(v & x), [4]u8{ 0b10100000, 0b00001010, 0b10101010, 0b00000000 })); |
| | 41 | } |
| | 42 | }; |
| | 43 | S.doTheTest(); |
| | 44 | comptime S.doTheTest(); |
| | 45 | } |