summary refs log tree commit diff
path: root/crypto/src/math/raw/Mod.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-10-07 20:05:14 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-10-07 20:05:14 +0700
commit782382c6f665a022effa71a3f7738cf1e09d9866 (patch)
tree66311deab21b35bc671561cbb419a0122c1b14f5 /crypto/src/math/raw/Mod.cs
parentFix exception type (diff)
downloadBouncyCastle.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.cs20
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)
         {