mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- $$MASK_TO_INT and $$INT_TO_MASK to create bool masks from integers and back.
- Fix bug when creating bool vectors in certain cases.
This commit is contained in:
10
test/unit/regression/vector_mask_test.c3
Normal file
10
test/unit/regression/vector_mask_test.c3
Normal file
@@ -0,0 +1,10 @@
|
||||
module vector_mask @test;
|
||||
import std::io, std::math;
|
||||
|
||||
fn void to_from_mask()
|
||||
{
|
||||
int x = (bool[<9>]){ true, false, true, false, false, false, false, false, true }.mask_to_int();
|
||||
test::eq(x, 0b100000101);
|
||||
bool[<10>] mask = vector::mask_from_int(bool[<10>], x);
|
||||
test::eq(mask, (bool[<10>]){ true, false, true, false, false, false, false, false, true, false });
|
||||
}
|
||||
Reference in New Issue
Block a user