- $$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:
Christoffer Lerno
2025-12-25 20:55:11 +01:00
parent 18b246c577
commit f3b71ed7eb
13 changed files with 193 additions and 30 deletions

View 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 });
}