TODO added. Small cleanup.
This commit is contained in:
1 parent
4ef7f636d2
commit
ef5f91ddd0
2 files changed
+7
-12
No files matched your search
@@ -6,6 +6,7 @@ using PerfectNumbers.Core.Gpu;
|
||||
|
||||
using EvenPerfectBitScanner.Candidates;
|
||||
using EvenPerfectBitScanner.Candidates.Transforms;
|
||||
using System.Numerics;
|
||||
|
||||
namespace EvenPerfectBitScanner.Tests;
|
||||
|
||||
@@ -15,7 +16,7 @@ public class ProgramTests
|
||||
[Fact]
|
||||
public void CountOnes_returns_correct_count()
|
||||
{
|
||||
Program.CountOnes(0b101010UL).Should().Be(3UL);
|
||||
(ulong)BitOperations.PopCount(0b101010UL).Should().Be(3UL);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
@@ -546,7 +546,7 @@ internal static class Program
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: Move this to a new static class CalculationResultsFile under IO namespace / folder. Rename it to LoadCandidatesWithinRange.
|
||||
private static List<ulong> LoadByDivisorCandidates(string candidateFile, UInt128 maxPrimeLimit, bool maxPrimeConfigured, out int skippedByLimit)
|
||||
{
|
||||
List<ulong> candidates = [];
|
||||
@@ -582,6 +582,7 @@ internal static class Program
|
||||
{
|
||||
index++;
|
||||
}
|
||||
|
||||
if (Utf8CliParser.TryParseUInt64(span[start..index], out ulong parsed))
|
||||
{
|
||||
if (!maxPrimeConfigured || (UInt128)parsed <= maxPrimeLimit)
|
||||
@@ -599,6 +600,7 @@ internal static class Program
|
||||
return candidates;
|
||||
}
|
||||
|
||||
// TODO: Move this to a new static class CalculationResultsFile under IO namespace / folder. Rename it to EnumerateCandidates.
|
||||
private static void LoadResultsFile(string resultsFileName, Action<ulong, bool, bool> lineProcessorAction)
|
||||
{
|
||||
using FileStream readStream = new(resultsFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||
@@ -658,6 +660,7 @@ internal static class Program
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Move this to a new static class CalculationResultsFile under IO namespace / folder. Rename it to BuildFileName.
|
||||
private static string BuildResultsFileName(bool bitInc, int threads, int block, GpuKernelType kernelType, bool useLucasFlag, bool useDivisorFlag, bool useByDivisorFlag, bool mersenneOnGpu, bool useOrder, bool useGcd, NttBackend nttBackend, int gpuPrimeThreads, int llSlice, int gpuScanBatch, ulong warmupLimit, ModReductionMode reduction, string mersenneDevice, string primesDevice, string orderDevice)
|
||||
{
|
||||
string inc = bitInc ? "bit" : "add";
|
||||
@@ -731,16 +734,6 @@ internal static class Program
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static ulong CountOnes(ulong value)
|
||||
{
|
||||
// TODO: Remove this wrapper once callers can invoke BitOperations.PopCount directly so the hot bit-stat path
|
||||
// avoids the extra call layer.
|
||||
return (ulong)BitOperations.PopCount(value);
|
||||
}
|
||||
|
||||
|
||||
internal static bool IsEvenPerfectCandidate(ulong p, ulong divisorCyclesSearchLimit, out bool searchedMersenne, out bool detailedCheck)
|
||||
{
|
||||
searchedMersenne = false;
|
||||
@@ -824,6 +817,7 @@ internal static class Program
|
||||
return detailedCheck;
|
||||
}
|
||||
|
||||
// TODO: Move this together with the tracker to existing CandidatesCalculator class in the Candidates folder.
|
||||
// Use ModResidueTracker with a small set of primes to pre-filter composite p.
|
||||
private static bool IsCompositeByResidues(ulong p)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user