summary refs log tree commit diff
path: root/crypto/src/math/raw
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-12-01 15:30:57 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-12-01 15:30:57 +0700
commitc79a3437110523519de2b4ef464194ea62b075c7 (patch)
tree827e91d665576c55be6798a914be5c100b74fa4f /crypto/src/math/raw
parentSecT233Field perf. opts. (diff)
downloadBouncyCastle.NET-ed25519-c79a3437110523519de2b4ef464194ea62b075c7.tar.xz
Missing file from commit
Diffstat (limited to 'crypto/src/math/raw')
-rw-r--r--crypto/src/math/raw/Nat256.cs22
1 files 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<ulong> x, Span<ulong> 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<uint> 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<ulong> x) +#else public static bool IsZero64(ulong[] x) +#endif { for (int i = 0; i < 4; ++i) { if (x[i] != 0UL) - { return false; - } } return true; }