mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-16 07:14:09 +02:00
Fixed some alignment differences between LLVM and BeefBE
This commit is contained in:
parent
0ae14f5a5d
commit
1ca01864bb
12 changed files with 73 additions and 21 deletions
31
IDEHelper/Tests/src/Arrays.bf
Normal file
31
IDEHelper/Tests/src/Arrays.bf
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
namespace Tests
|
||||
{
|
||||
class Arrays
|
||||
{
|
||||
struct StructA
|
||||
{
|
||||
public int16 mA = 11;
|
||||
public int16 mB = 22;
|
||||
public int16 mC = 33;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestPacking()
|
||||
{
|
||||
StructA[] arr = scope .[3](.(), );
|
||||
|
||||
ref StructA sa = ref arr[0];
|
||||
Test.Assert(sa.mA == 11);
|
||||
Test.Assert(sa.mB == 22);
|
||||
Test.Assert(sa.mC == 33);
|
||||
|
||||
#if BF_64_BIT
|
||||
/*int a = (int)(void*)&sa - (int)Internal.UnsafeCastToPtr(arr);
|
||||
int b = typeof(System.Array).InstanceSize;
|
||||
|
||||
Test.Assert((int)(void*)&sa - (int)Internal.UnsafeCastToPtr(arr) == sizeof(System.Array));*/
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
|
@ -97,6 +97,15 @@ namespace Tests
|
|||
public float mD = 4;
|
||||
}
|
||||
|
||||
[Test]
|
||||
static void TestTypes()
|
||||
{
|
||||
Type t = typeof(int32);
|
||||
Test.Assert(t.InstanceSize == 4);
|
||||
t = typeof(int64);
|
||||
Test.Assert(t.InstanceSize == 8);
|
||||
}
|
||||
|
||||
[Test]
|
||||
static void TestA()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue