Skip to content

Commit

Permalink
Fixed test error in ByteArrayComparer.Compare
Browse files Browse the repository at this point in the history
  • Loading branch information
cschuchardt88 committed Feb 13, 2024
1 parent 326bdce commit 8768236
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Neo.IO/ByteArrayComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ private ByteArrayComparer(int direction)

public int Compare(byte[]? x, byte[]? y)
{
if (x is not null && y is not null && x == y) return 0;
if (x is null && y is null) return 0;
if (x == y) return 0;
if (x is null && y is not null)
return _direction > 0 ? -y.Length : y.Length;
if (y is null && x is not null)
return _direction > 0 ? x.Length : -x.Length;
if (x is not null && y is not null)
return _direction > 0 ?
CompareInternal(x, y) :
-CompareInternal(x, y);
return 0;
return _direction > 0 ?
CompareInternal(x!, y!) :
-CompareInternal(x!, y!);
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
Expand Down

0 comments on commit 8768236

Please sign in to comment.