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

@@ -109,6 +109,13 @@ internal sealed class MersenneNumberDivisorResidueGpuEvaluator : IDisposable
}
ulong exponent = exponents[idx];
results[idx] = exponent.Pow2MontgomeryModWindowedGpu(divisorData, keepMontgomery: true);
ulong modulus = divisorData.Modulus;
if (modulus <= 1UL || (modulus & 1UL) == 0UL)
{
results[idx] = 0UL;
return;
}
results[idx] = exponent.Pow2ModBinaryGpu(modulus);
}
}