Restore pre-residue mode behavior and tests
This commit is contained in:
1 parent
23e8d306b1
commit
aa683215b2
8 files changed
+51
-678
No files matched your search
@@ -16,7 +16,6 @@ public enum GpuKernelType
|
||||
}
|
||||
|
||||
public sealed class MersenneNumberTester(
|
||||
UInt128 maxK,
|
||||
bool useIncremental = true,
|
||||
bool useOrderCache = false,
|
||||
GpuKernelType kernelType = GpuKernelType.Incremental,
|
||||
@@ -25,11 +24,12 @@ public sealed class MersenneNumberTester(
|
||||
bool useGpuLucas = true,
|
||||
bool useGpuScan = true,
|
||||
bool useGpuOrder = true,
|
||||
bool useResidue = true)
|
||||
bool useResidue = true,
|
||||
ulong maxK = 5_000_000UL)
|
||||
{
|
||||
private readonly bool _useResidue = useResidue;
|
||||
private readonly bool _useIncremental = useIncremental && !useResidue;
|
||||
private readonly UInt128 _maxK = maxK;
|
||||
private readonly ulong _maxK = maxK;
|
||||
private readonly GpuKernelType _kernelType = kernelType;
|
||||
private readonly bool _useModuloWorkaround = useModuloWorkaround;
|
||||
private readonly bool _useGpuLucas = useGpuLucas;
|
||||
@@ -228,6 +228,11 @@ public sealed class MersenneNumberTester(
|
||||
// In residue mode the residue scan is the final primality check.
|
||||
if (_useResidue)
|
||||
{
|
||||
if ((UInt128)_maxK < maxK)
|
||||
{
|
||||
maxK = _maxK;
|
||||
}
|
||||
|
||||
if (_useGpuScan)
|
||||
{
|
||||
_residueGpuTester!.Scan(exponent, twoP, lastIsSeven, maxK, ref prePrime);
|
||||
|
||||
Reference in new issue
Block a user