Align GPU prime sieve with CPU GCD heuristic
This commit is contained in:
1 parent
a5fafd6ebf
commit
1ec71f8cfd
1 file changed
+8
-5
@@ -255,12 +255,15 @@ public sealed class PrimeTester(bool useInternal = false)
|
||||
return;
|
||||
}
|
||||
|
||||
// Early reject special gcd heuristic with floor(log2 n)
|
||||
ulong m = 63UL - (ulong)ILGPU.Algorithms.XMath.LeadingZeroCount(n);
|
||||
if (BinaryGcdGpu(n, m) != 1UL)
|
||||
if ((n % 10UL) == 1UL)
|
||||
{
|
||||
results[index] = 0;
|
||||
return;
|
||||
// Early reject special GCD heuristic with floor(log2 n)
|
||||
ulong m = 63UL - (ulong)ILGPU.Algorithms.XMath.LeadingZeroCount(n);
|
||||
if (BinaryGcdGpu(n, m) != 1UL)
|
||||
{
|
||||
results[index] = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
long len = smallPrimes.Length;
|
||||
|
||||
Reference in new issue
Block a user