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:
parent
47732ae09c
commit
cafbcd30dc
3 changed files with 23 additions and 11 deletions
|
@ -420,6 +420,7 @@ namespace Tests
|
|||
{
|
||||
if (!MoveNext())
|
||||
return .Err;
|
||||
#unwarn
|
||||
return &CurrentRef;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue