Merge pull request #177 from mlemanczyk/codex/naprawic-bad-kompilacji-math.divrem

Replace invalid DivRem usage in prime factor extraction
This commit is contained in:
Marek Lemańczyk authored and GitHub committed 2025-10-16 22:01:44 +02:00
commit b5f8ed786c
1 file changed
+3 -2
+3 -2
View File
@@ -1205,11 +1205,12 @@ internal static partial class PrimeOrderCalculator
continue;
}
// Use DivRem to reuse a single division for the quotient and remainder.
// Derive the remainder from the quotient to avoid an extra division.
int exponent = 0;
while (true)
{
ulong quotient = Math.DivRem(remainingLocal, primeCandidate, out ulong divisionRemainder);
ulong quotient = remainingLocal / primeCandidate;
ulong divisionRemainder = remainingLocal - (quotient * primeCandidate);
if (divisionRemainder != 0UL)
{
break;