Switch single-use GPU exponent checks to standard modular math

This commit is contained in:
Marek Lemańczyk committed 2025-10-13 04:58:20 +02:00
1 parent 7ef0906a9b
commit b07bf769c9
6 files changed
+71 -16

No files matched your search

@@ -811,7 +811,7 @@ internal static partial class PrimeOrderGpuHeuristics
}
ulong reduced = phi / factor;
if (reduced.Pow2MontgomeryModWindowedGpu(divisor, keepMontgomery: false) == 1UL)
if (reduced.Pow2ModBinaryGpu(divisor.Modulus) == 1UL)
{
return false;
}
@@ -1595,7 +1595,7 @@ internal static partial class PrimeOrderGpuHeuristics
private static bool Pow2EqualsOneKernel(ulong exponent, in MontgomeryDivisorData divisor)
{
return exponent.Pow2MontgomeryModWindowedGpu(divisor, keepMontgomery: false) == 1UL;
return exponent.Pow2ModBinaryGpu(divisor.Modulus) == 1UL;
}
private static ulong CalculateByDoublingKernel(ulong prime)