diff --git a/global.json b/global.json
index c33ebd2..a73871d 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "8.0.0",
+ "version": "9.0.0",
"allowPrerelease": false,
"rollForward": "latestFeature"
}
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 4d6c02d..66c4c20 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -5,7 +5,7 @@
true
latest
enable
- net8.0
+ net9.0
diff --git a/src/Nethermind.Int256/Int256.cs b/src/Nethermind.Int256/Int256.cs
index 60d0aa0..e1d6ca6 100644
--- a/src/Nethermind.Int256/Int256.cs
+++ b/src/Nethermind.Int256/Int256.cs
@@ -7,7 +7,7 @@
namespace Nethermind.Int256
{
- public readonly struct Int256 : IComparable, IComparable, IInteger, IConvertible
+ public readonly struct Int256 : IEquatable, IComparable, IComparable, IInteger, IConvertible
{
public static readonly Int256 Zero = (Int256)0UL;
public static readonly Int256 One = (Int256)1UL;
@@ -530,8 +530,11 @@ public override string ToString()
return ToString(null);
}
+ [OverloadResolutionPriority(1)]
private bool Equals(in Int256 other) => _value.Equals(other._value);
+ public bool Equals(Int256 other) => _value.Equals(other._value);
+
public override bool Equals(object? obj) => obj is Int256 other && Equals(other);
public override int GetHashCode() => _value.GetHashCode();
diff --git a/src/Nethermind.Int256/UInt256.cs b/src/Nethermind.Int256/UInt256.cs
index 21a19f5..5661359 100644
--- a/src/Nethermind.Int256/UInt256.cs
+++ b/src/Nethermind.Int256/UInt256.cs
@@ -13,7 +13,7 @@
namespace Nethermind.Int256
{
[StructLayout(LayoutKind.Explicit)]
- public readonly struct UInt256 : IComparable, IComparable, IInteger, IConvertible
+ public readonly struct UInt256 : IEquatable, IComparable, IComparable, IInteger, IConvertible
{
public static readonly UInt256 Zero = 0ul;
public static readonly UInt256 One = 1ul;
@@ -1803,13 +1803,6 @@ public string ToString(string format)
public bool IsUint64 => (u1 | u2 | u3) == 0;
- public bool Equals(UInt256 other)
- {
- var v1 = Unsafe.As>(ref Unsafe.AsRef(in u0));
- var v2 = Unsafe.As>(ref Unsafe.AsRef(in other));
- return v1 == v2;
- }
-
public bool Equals(int other)
{
return other >= 0 && Equals((uint)other);
@@ -1843,8 +1836,16 @@ public bool Equals(ulong other)
}
}
+ [OverloadResolutionPriority(1)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private bool Equals(in UInt256 other)
+ public bool Equals(in UInt256 other)
+ {
+ var v1 = Unsafe.As>(ref Unsafe.AsRef(in u0));
+ var v2 = Unsafe.As>(ref Unsafe.AsRef(in other));
+ return v1 == v2;
+ }
+
+ public bool Equals(UInt256 other)
{
var v1 = Unsafe.As>(ref Unsafe.AsRef(in u0));
var v2 = Unsafe.As>(ref Unsafe.AsRef(in other));