diff --git a/crypto/src/math/raw/Nat128.cs b/crypto/src/math/raw/Nat128.cs
index d336b320a..0705844e7 100644
--- a/crypto/src/math/raw/Nat128.cs
+++ b/crypto/src/math/raw/Nat128.cs
@@ -131,6 +131,14 @@ namespace Org.BouncyCastle.Math.Raw
z[zOff + 1] = x[xOff + 1];
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static void Copy64(ReadOnlySpan<ulong> x, Span<ulong> z)
+ {
+ z[0] = x[0];
+ z[1] = x[1];
+ }
+#endif
+
public static uint[] Create()
{
return new uint[4];
@@ -270,7 +278,11 @@ namespace Org.BouncyCastle.Math.Raw
return true;
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static bool IsZero64(ReadOnlySpan<ulong> x)
+#else
public static bool IsZero64(ulong[] x)
+#endif
{
for (int i = 0; i < 2; ++i)
{
diff --git a/crypto/src/math/raw/Nat192.cs b/crypto/src/math/raw/Nat192.cs
index 752290747..7c36b21cf 100644
--- a/crypto/src/math/raw/Nat192.cs
+++ b/crypto/src/math/raw/Nat192.cs
@@ -169,6 +169,15 @@ namespace Org.BouncyCastle.Math.Raw
z[zOff + 2] = x[xOff + 2];
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static void Copy64(ReadOnlySpan<ulong> x, Span<ulong> z)
+ {
+ z[0] = x[0];
+ z[1] = x[1];
+ z[2] = x[2];
+ }
+#endif
+
public static uint[] Create()
{
return new uint[6];
@@ -310,7 +319,11 @@ namespace Org.BouncyCastle.Math.Raw
return true;
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static bool IsZero64(ReadOnlySpan<ulong> x)
+#else
public static bool IsZero64(ulong[] x)
+#endif
{
for (int i = 0; i < 3; ++i)
{
diff --git a/crypto/src/math/raw/Nat320.cs b/crypto/src/math/raw/Nat320.cs
index 0b250aa77..06f7b58cc 100644
--- a/crypto/src/math/raw/Nat320.cs
+++ b/crypto/src/math/raw/Nat320.cs
@@ -25,6 +25,17 @@ namespace Org.BouncyCastle.Math.Raw
z[zOff + 4] = x[xOff + 4];
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static void Copy64(ReadOnlySpan<ulong> x, Span<ulong> z)
+ {
+ z[0] = x[0];
+ z[1] = x[1];
+ z[2] = x[2];
+ z[3] = x[3];
+ z[4] = x[4];
+ }
+#endif
+
public static ulong[] Create64()
{
return new ulong[5];
@@ -63,7 +74,11 @@ namespace Org.BouncyCastle.Math.Raw
return true;
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static bool IsZero64(ReadOnlySpan<ulong> x)
+#else
public static bool IsZero64(ulong[] x)
+#endif
{
for (int i = 0; i < 5; ++i)
{
diff --git a/crypto/src/math/raw/Nat448.cs b/crypto/src/math/raw/Nat448.cs
index 688f327a4..2da03bf0f 100644
--- a/crypto/src/math/raw/Nat448.cs
+++ b/crypto/src/math/raw/Nat448.cs
@@ -29,6 +29,19 @@ namespace Org.BouncyCastle.Math.Raw
z[zOff + 6] = x[xOff + 6];
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static void Copy64(ReadOnlySpan<ulong> x, Span<ulong> z)
+ {
+ z[0] = x[0];
+ z[1] = x[1];
+ z[2] = x[2];
+ z[3] = x[3];
+ z[4] = x[4];
+ z[5] = x[5];
+ z[6] = x[6];
+ }
+#endif
+
public static ulong[] Create64()
{
return new ulong[7];
@@ -67,7 +80,11 @@ namespace Org.BouncyCastle.Math.Raw
return true;
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static bool IsZero64(ReadOnlySpan<ulong> x)
+#else
public static bool IsZero64(ulong[] x)
+#endif
{
for (int i = 0; i < 7; ++i)
{
diff --git a/crypto/src/math/raw/Nat576.cs b/crypto/src/math/raw/Nat576.cs
index 174d52bcf..3525a0f05 100644
--- a/crypto/src/math/raw/Nat576.cs
+++ b/crypto/src/math/raw/Nat576.cs
@@ -33,6 +33,21 @@ namespace Org.BouncyCastle.Math.Raw
z[zOff + 8] = x[xOff + 8];
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static void Copy64(ReadOnlySpan<ulong> x, Span<ulong> z)
+ {
+ z[0] = x[0];
+ z[1] = x[1];
+ z[2] = x[2];
+ z[3] = x[3];
+ z[4] = x[4];
+ z[5] = x[5];
+ z[6] = x[6];
+ z[7] = x[7];
+ z[8] = x[8];
+ }
+#endif
+
public static ulong[] Create64()
{
return new ulong[9];
@@ -71,7 +86,11 @@ namespace Org.BouncyCastle.Math.Raw
return true;
}
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+ public static bool IsZero64(ReadOnlySpan<ulong> x)
+#else
public static bool IsZero64(ulong[] x)
+#endif
{
for (int i = 0; i < 9; ++i)
{
|