diff --git a/src/Neo.IO/ByteArrayComparer.cs b/src/Neo.IO/ByteArrayComparer.cs index b59c5a28f5..4be5ef7330 100644 --- a/src/Neo.IO/ByteArrayComparer.cs +++ b/src/Neo.IO/ByteArrayComparer.cs @@ -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)]