diff --git a/crypto/src/math/raw/Nat.cs b/crypto/src/math/raw/Nat.cs
index 80ea6d7ce..b524750d8 100644
--- a/crypto/src/math/raw/Nat.cs
+++ b/crypto/src/math/raw/Nat.cs
@@ -743,7 +743,11 @@ namespace Org.BouncyCastle.Math.Raw
}
#endif
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static uint EqualTo(int len, ReadOnlySpan<uint> x, uint y)
+#else
public static uint EqualTo(int len, uint[] x, uint y)
+#endif
{
uint d = x[0] ^ y;
for (int i = 1; i < len; ++i)
@@ -766,19 +770,10 @@ namespace Org.BouncyCastle.Math.Raw
}
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
- public static uint EqualTo(int len, ReadOnlySpan<uint> x, uint y)
- {
- uint d = x[0] ^ y;
- for (int i = 1; i < len; ++i)
- {
- d |= x[i];
- }
- d = (d >> 1) | (d & 1);
- return (uint)(((int)d - 1) >> 31);
- }
-#endif
-
+ public static uint EqualTo(int len, ReadOnlySpan<uint> x, ReadOnlySpan<uint> y)
+#else
public static uint EqualTo(int len, uint[] x, uint[] y)
+#endif
{
uint d = 0;
for (int i = 0; i < len; ++i)
@@ -800,20 +795,12 @@ namespace Org.BouncyCastle.Math.Raw
return (uint)(((int)d - 1) >> 31);
}
-#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
- public static uint EqualTo(int len, ReadOnlySpan<uint> x, ReadOnlySpan<uint> y)
- {
- uint d = 0;
- for (int i = 0; i < len; ++i)
- {
- d |= x[i] ^ y[i];
- }
- d = (d >> 1) | (d & 1);
- return (uint)(((int)d - 1) >> 31);
- }
-#endif
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static uint EqualToZero(int len, ReadOnlySpan<uint> x)
+#else
public static uint EqualToZero(int len, uint[] x)
+#endif
{
uint d = 0;
for (int i = 0; i < len; ++i)
@@ -835,19 +822,6 @@ namespace Org.BouncyCastle.Math.Raw
return (uint)(((int)d - 1) >> 31);
}
-#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
- public static uint EqualToZero(int len, ReadOnlySpan<uint> x)
- {
- uint d = 0;
- for (int i = 0; i < len; ++i)
- {
- d |= x[i];
- }
- d = (d >> 1) | (d & 1);
- return (uint)(((int)d - 1) >> 31);
- }
-#endif
-
public static uint[] FromBigInteger(int bits, BigInteger x)
{
if (x.SignValue < 0 || x.BitLength > bits)
|