Skip to content

Commit

Permalink
Explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Jan 12, 2020
1 parent b9fd397 commit 6b52a79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/neo/UInt160.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ namespace Neo
/// <summary>
/// This class stores a 160 bit unsigned int, represented as a 20-byte little-endian byte array
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
[StructLayout(LayoutKind.Explicit, Size = 20)]
public class UInt160 : UIntBase, IComparable<UInt160>, IEquatable<UInt160>
{
public const int Length = 20;
public static readonly UInt160 Zero = new UInt160();

private ulong value1;
private ulong value2;
private uint value3;
[FieldOffset(0)] private ulong value1;
[FieldOffset(8)] private ulong value2;
[FieldOffset(16)] private uint value3;

public override int Size => Length;

Expand Down
10 changes: 5 additions & 5 deletions src/neo/UInt256.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ namespace Neo
/// <summary>
/// This class stores a 256 bit unsigned int, represented as a 32-byte little-endian byte array
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
[StructLayout(LayoutKind.Explicit, Size = 32)]
public class UInt256 : UIntBase, IComparable<UInt256>, IEquatable<UInt256>
{
public const int Length = 32;
public static readonly UInt256 Zero = new UInt256();

private ulong value1;
private ulong value2;
private ulong value3;
private ulong value4;
[FieldOffset(0)] private ulong value1;
[FieldOffset(8)] private ulong value2;
[FieldOffset(16)] private ulong value3;
[FieldOffset(24)] private ulong value4;

public override int Size => Length;

Expand Down

0 comments on commit 6b52a79

Please sign in to comment.