diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-07 20:05:14 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-07 20:05:14 +0700 |
commit | 782382c6f665a022effa71a3f7738cf1e09d9866 (patch) | |
tree | 66311deab21b35bc671561cbb419a0122c1b14f5 /crypto/src/math/raw/Mod.cs | |
parent | Fix exception type (diff) | |
download | BouncyCastle.NET-ed25519-782382c6f665a022effa71a3f7738cf1e09d9866.tar.xz |
Span usage in Math.Raw
Diffstat (limited to 'crypto/src/math/raw/Mod.cs')
-rw-r--r-- | crypto/src/math/raw/Mod.cs | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/crypto/src/math/raw/Mod.cs b/crypto/src/math/raw/Mod.cs index a46a7cdfa..ea61bdd83 100644 --- a/crypto/src/math/raw/Mod.cs +++ b/crypto/src/math/raw/Mod.cs @@ -19,33 +19,25 @@ namespace Org.BouncyCastle.Math.Raw private const int M30 = 0x3FFFFFFF; private const ulong M32UL = 0xFFFFFFFFUL; - public static void CheckedModOddInverse(uint[] m, uint[] x, uint[] z) - { - if (0 == ModOddInverse(m, x, z)) - throw new ArithmeticException("Inverse does not exist."); - } - #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER public static void CheckedModOddInverse(ReadOnlySpan<uint> m, ReadOnlySpan<uint> x, Span<uint> z) - { - if (0 == ModOddInverse(m, x, z)) - throw new ArithmeticException("Inverse does not exist."); - } +#else + public static void CheckedModOddInverse(uint[] m, uint[] x, uint[] z) #endif - - public static void CheckedModOddInverseVar(uint[] m, uint[] x, uint[] z) { - if (!ModOddInverseVar(m, x, z)) + if (0 == ModOddInverse(m, x, z)) throw new ArithmeticException("Inverse does not exist."); } #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER public static void CheckedModOddInverseVar(ReadOnlySpan<uint> m, ReadOnlySpan<uint> x, Span<uint> z) +#else + public static void CheckedModOddInverseVar(uint[] m, uint[] x, uint[] z) +#endif { if (!ModOddInverseVar(m, x, z)) throw new ArithmeticException("Inverse does not exist."); } -#endif public static uint Inverse32(uint d) { |