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

@@ -18,7 +18,7 @@ public struct BigIntegerCycleRemainderStepper(BigInteger cycleLength)
public BigInteger Initialize(BigInteger value)
{
_previousValue = value;
_currentRemainder = value % _cycleLength;
_currentRemainder = value.ReduceCycleRemainder(_cycleLength);
return _currentRemainder;
}
@@ -27,11 +27,7 @@ public struct BigIntegerCycleRemainderStepper(BigInteger cycleLength)
{
BigInteger delta = value - _previousValue;
_previousValue = value;
_currentRemainder += delta;
if (_currentRemainder >= _cycleLength)
{
_currentRemainder %= _cycleLength;
}
_currentRemainder = (_currentRemainder + delta).ReduceCycleRemainder(_cycleLength);
return _currentRemainder;
}