Modulo operators replaced with steppers, where possible.
This commit is contained in:
1 parent
475507ce0c
commit
f7dbc017a9
15 files changed
+531
-151
No files matched your search
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ILGPU;
|
||||
using ILGPU.Runtime;
|
||||
using PerfectNumbers.Core.Gpu.Accelerators;
|
||||
|
||||
@@ -72,7 +70,7 @@ public sealed class PrimeTester
|
||||
}
|
||||
|
||||
divisor = smallPrimeDivisors[i];
|
||||
uint deltaMod = delta >= divisor ? (uint)(delta % divisor) : (uint)delta;
|
||||
uint deltaMod = delta.ReduceCycleRemainder(divisor);
|
||||
remainder = remainders[i] + deltaMod;
|
||||
if (remainder >= divisor)
|
||||
{
|
||||
@@ -105,7 +103,7 @@ public sealed class PrimeTester
|
||||
}
|
||||
|
||||
divisor = smallPrimeDivisors[i];
|
||||
remainder = (uint)(n % divisor);
|
||||
remainder = n.ReduceCycleRemainder(divisor);
|
||||
remainders[i] = remainder;
|
||||
|
||||
if (remainder == 0UL)
|
||||
|
||||
Reference in new issue
Block a user