% 10 operations replaces with UInt128/ulong.Mod10 methods

This commit is contained in:
Marek Lemańczyk committed 2025-09-21 07:42:25 +02:00
1 parent 3e0102a404
commit 412ce4fd50
13 files changed
+256 -195

No files matched your search

+2 -2
View File
@@ -59,7 +59,7 @@ public sealed class PrimeTester(bool useInternal = false)
}
else
{
if ((n % 10UL) == 1UL && SharesFactorWithMaxExponent(n))
if (n.Mod10() == 1UL && SharesFactorWithMaxExponent(n))
{
result = false;
}
@@ -266,7 +266,7 @@ public sealed class PrimeTester(bool useInternal = false)
return;
}
if ((n % 10UL) == 1UL)
if (n.Mod10() == 1UL)
{
// Early reject special GCD heuristic with floor(log2 n)
ulong m = 63UL - (ulong)ILGPU.Algorithms.XMath.LeadingZeroCount(n);