Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[valuetypes] use memcmp in default implementation of Equals for unali…
…gned fields some architectures (e.g. ARM) do not support reads of unaligned pointers fixes mono#6320
- Loading branch information
Showing
3 changed files
with
68 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Test { | ||
[StructLayout ( LayoutKind.Explicit )] | ||
public struct ST0 { | ||
[FieldOffset(0)] public short S0; | ||
[FieldOffset(2)] public int I0; | ||
[FieldOffset(6)] public long L0; | ||
[FieldOffset(14)] public float F0; | ||
[FieldOffset(18)] public double D0; | ||
} | ||
|
||
public class Test { | ||
public static int Main() { | ||
ST0 s0, s1; | ||
s0 = s1 = new ST0(); | ||
return s0.Equals (s1) ? 0 : 1; | ||
} | ||
} | ||
} |