mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-26 11:38:02 +02:00
Initial checkin
This commit is contained in:
parent
c74712dad9
commit
078564ac9e
3242 changed files with 1616395 additions and 0 deletions
58
IDE/Tests/Test1/src/Unions.bf
Normal file
58
IDE/Tests/Test1/src/Unions.bf
Normal file
|
@ -0,0 +1,58 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
|
||||
namespace IDETest
|
||||
{
|
||||
class Unions
|
||||
{
|
||||
struct InnerA
|
||||
{
|
||||
public int32 mInt0;
|
||||
public int32 mInt1;
|
||||
}
|
||||
|
||||
struct InnerB
|
||||
{
|
||||
public InnerA mInnerA;
|
||||
}
|
||||
|
||||
[Union]
|
||||
struct UStruct
|
||||
{
|
||||
public InnerB mInnerB;
|
||||
}
|
||||
|
||||
[Union]
|
||||
struct UStruct2
|
||||
{
|
||||
public InnerB mInnerB;
|
||||
public int64 mFullInt;
|
||||
}
|
||||
|
||||
public static void UseUnion(UStruct us)
|
||||
{
|
||||
int a = us.mInnerB.mInnerA.mInt0;
|
||||
int b = us.mInnerB.mInnerA.mInt1;
|
||||
}
|
||||
|
||||
public static void UseUnion2(UStruct2 us)
|
||||
{
|
||||
int a2 = us.mInnerB.mInnerA.mInt0;
|
||||
int b2 = us.mInnerB.mInnerA.mInt1;
|
||||
}
|
||||
|
||||
public static void Test()
|
||||
{
|
||||
//Test_Start
|
||||
UStruct us;
|
||||
us.mInnerB.mInnerA.mInt0 = 12;
|
||||
us.mInnerB.mInnerA.mInt1 = 23;
|
||||
UseUnion(us);
|
||||
|
||||
UStruct2 us2;
|
||||
us2..mFullInt = 0x11223344'55667788;
|
||||
UseUnion2(us2);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue