1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-28 04:28:01 +02:00

Fixed ExtractValue for splat unions

This commit is contained in:
Brian Fiete 2022-09-10 10:25:45 -07:00
parent 47732ae09c
commit cafbcd30dc
3 changed files with 23 additions and 11 deletions

View file

@ -420,6 +420,7 @@ namespace Tests
{
if (!MoveNext())
return .Err;
#unwarn
return &CurrentRef;
}
}

View file

@ -35,6 +35,18 @@ namespace Tests
public int16 mInt16;
}
[Union]
public struct UnionE
{
public uint32 values;
public int r
{
get { return uint8((this.values & 0xFF000000) >> 24); }
set mut { this.values = (this.values & 0x00FFFFFF) | ((uint32(value) & 0x000000FF) << 24); }
}
}
[Test]
static void TestBasics()
{
@ -54,6 +66,10 @@ namespace Tests
Test.Assert(sizeof(UnionD) == 6);
Test.Assert(alignof(UnionD) == 4);
Test.Assert(((int16*)&ud)[2] == 234);
UnionE ue = .();
ue.r = 123;
Test.Assert(ue.r == 123);
}
}
}