Skip to content

Commit

Permalink
ToArray Optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed Jan 18, 2019
1 parent b46a694 commit 4dcc992
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions neo/UInt160.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public UInt160(byte[] value)
/// </summary>
public unsafe int CompareTo(UInt160 other)
{
fixed (byte* px = ToArray(), py = other.ToArray())
fixed (byte* px = data_bytes, py = other.data_bytes)
{
uint* lpx = (uint*)px;
uint* lpy = (uint*)py;
Expand All @@ -54,7 +54,7 @@ public unsafe int CompareTo(UInt160 other)
/// </summary>
public unsafe bool Equals(UInt160 other)
{
fixed (byte* px = ToArray(), py = other.ToArray())
fixed (byte* px = data_bytes, py = other.data_bytes)
{
uint* lpx = (uint*)px;
uint* lpy = (uint*)py;
Expand Down
4 changes: 2 additions & 2 deletions neo/UInt256.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public UInt256(byte[] value)
/// </summary>
public unsafe int CompareTo(UInt256 other)
{
fixed (byte* px = ToArray(), py = other.ToArray())
fixed (byte* px = data_bytes, py = other.data_bytes)
{
ulong* lpx = (ulong*)px;
ulong* lpy = (ulong*)py;
Expand All @@ -55,7 +55,7 @@ public unsafe int CompareTo(UInt256 other)
/// </summary>
public unsafe bool Equals(UInt256 other)
{
fixed (byte* px = ToArray(), py = other.ToArray())
fixed (byte* px = data_bytes, py = other.data_bytes)
{
ulong* lpx = (ulong*)px;
ulong* lpy = (ulong*)py;
Expand Down
2 changes: 1 addition & 1 deletion neo/UIntBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public abstract class UIntBase : IEquatable<UIntBase>, ISerializable
/// <summary>
/// Storing unsigned int in a little-endian byte array.
/// </summary>
private byte[] data_bytes;
protected readonly byte[] data_bytes;

/// <summary>
/// Number of bytes of the unsigned int.
Expand Down

0 comments on commit 4dcc992

Please sign in to comment.