mirror of https://github.com/SixLabors/ImageSharp
7 changed files with 168 additions and 78 deletions
@ -0,0 +1,62 @@ |
|||
namespace ImageSharp.Tests.Common |
|||
{ |
|||
using Xunit; |
|||
|
|||
public static class TestStructs |
|||
{ |
|||
public struct Foo |
|||
{ |
|||
public int A; |
|||
|
|||
public double B; |
|||
|
|||
public Foo(int a, double b) |
|||
{ |
|||
this.A = a; |
|||
this.B = b; |
|||
} |
|||
|
|||
internal static Foo[] CreateArray(int size) |
|||
{ |
|||
Foo[] result = new Foo[size]; |
|||
for (int i = 0; i < size; i++) |
|||
{ |
|||
result[i] = new Foo(i + 1, i + 1); |
|||
} |
|||
return result; |
|||
} |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// sizeof(AlignedFoo) == sizeof(long)
|
|||
/// </summary>
|
|||
public unsafe struct AlignedFoo |
|||
{ |
|||
public int A; |
|||
|
|||
public int B; |
|||
|
|||
static AlignedFoo() |
|||
{ |
|||
Assert.Equal(sizeof(AlignedFoo), sizeof(long)); |
|||
} |
|||
|
|||
public AlignedFoo(int a, int b) |
|||
{ |
|||
this.A = a; |
|||
this.B = b; |
|||
} |
|||
|
|||
internal static AlignedFoo[] CreateArray(int size) |
|||
{ |
|||
AlignedFoo[] result = new AlignedFoo[size]; |
|||
for (int i = 0; i < size; i++) |
|||
{ |
|||
result[i] = new AlignedFoo(i + 1, i + 1); |
|||
} |
|||
return result; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue