Modulo operators replaced with steppers, where possible.

This commit is contained in:
mlemanczyk committed 2025-12-08 20:57:47 +01:00
1 parent 475507ce0c
commit f7dbc017a9
15 files changed
+531 -151

No files matched your search

+3 -3
View File
@@ -360,9 +360,9 @@ namespace PerfectNumbers.Core
private static bool _hasExponentRemainderStepperCpu;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static ExponentRemainderStepperCpu RentExponentStepperCpu(in MontgomeryDivisorData divisorData)
internal static ExponentRemainderStepperCpu RentExponentStepperCpu(in MontgomeryDivisorData divisorData, ulong cycleLength = 0UL)
{
if (_hasExponentRemainderStepperCpu && _exponentRemainderStepperCpu.MatchesDivisor(divisorData))
if (_hasExponentRemainderStepperCpu && _exponentRemainderStepperCpu.MatchesDivisor(divisorData, cycleLength))
{
ExponentRemainderStepperCpu stepper = _exponentRemainderStepperCpu;
_hasExponentRemainderStepperCpu = false;
@@ -370,7 +370,7 @@ namespace PerfectNumbers.Core
return stepper;
}
return new ExponentRemainderStepperCpu(divisorData);
return new ExponentRemainderStepperCpu(divisorData, cycleLength);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]