From c79a3437110523519de2b4ef464194ea62b075c7 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 1 Dec 2022 15:30:57 +0700 Subject: Missing file from commit --- crypto/src/math/raw/Nat256.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/crypto/src/math/raw/Nat256.cs b/crypto/src/math/raw/Nat256.cs index 1bedeb51c..edf793d3d 100644 --- a/crypto/src/math/raw/Nat256.cs +++ b/crypto/src/math/raw/Nat256.cs @@ -305,6 +305,16 @@ namespace Org.BouncyCastle.Math.Raw z[zOff + 3] = x[xOff + 3]; } +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public static void Copy64(ReadOnlySpan x, Span z) + { + z[0] = x[0]; + z[1] = x[1]; + z[2] = x[2]; + z[3] = x[3]; + } +#endif + public static uint[] Create() { return new uint[8]; @@ -449,26 +459,30 @@ namespace Org.BouncyCastle.Math.Raw return true; } +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public static bool IsZero(ReadOnlySpan x) +#else public static bool IsZero(uint[] x) +#endif { for (int i = 0; i < 8; ++i) { if (x[i] != 0) - { return false; - } } return true; } +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + public static bool IsZero64(ReadOnlySpan x) +#else public static bool IsZero64(ulong[] x) +#endif { for (int i = 0; i < 4; ++i) { if (x[i] != 0UL) - { return false; - } } return true; } -- cgit 1.4.1