Tiny cleanup

This commit is contained in:
mlemanczyk committed 2025-10-18 18:08:50 +02:00
1 parent 2ba193bd65
commit ca07ed3388
1 file changed
+23 -23
+23 -23
View File
@@ -892,7 +892,7 @@ internal static class Program
List<ulong> candidates = new(targetCount); List<ulong> candidates = new(targetCount);
ulong previous = 29UL; ulong previous = 29UL;
int remaining = targetCount; int remaining = targetCount;
ulong nextPrime = 0UL; ulong nextPrime;
while (remaining > 0) while (remaining > 0)
{ {
@@ -994,7 +994,7 @@ internal static class Program
// the CLI avoids this extra frame during the hot composite-reporting path. // the CLI avoids this extra frame during the hot composite-reporting path.
MersenneNumberDivisorByDivisorTester.Run( MersenneNumberDivisorByDivisorTester.Run(
candidates, candidates,
_byDivisorTester, _byDivisorTester!,
_byDivisorPreviousResults, _byDivisorPreviousResults,
_byDivisorStartPrime, _byDivisorStartPrime,
static () => _lastCompositeP = true, static () => _lastCompositeP = true,
@@ -1484,8 +1484,8 @@ internal static class Program
ulong primeCandidate = value; ulong primeCandidate = value;
bool advanceAdd = true; bool advanceAdd = true;
bool advancePrime = true; bool advancePrime = true;
ulong diff = 0UL; ulong diff;
ulong nextPrime = 0UL; ulong nextPrime;
while (true) while (true)
{ {
@@ -1576,9 +1576,9 @@ internal static class Program
if (_zeroFracHard >= 0 || (_zeroFracConj >= 0 && _maxZeroConj >= 0)) if (_zeroFracHard >= 0 || (_zeroFracConj >= 0 && _maxZeroConj >= 0))
{ {
double zf; double zf;
int bitLength = 0; int bitLength;
int zeroCountValue = 0; int zeroCountValue;
int maxZeroBlockValue = 0; int maxZeroBlockValue;
ComputeBitStats(p, out bitLength, out zeroCountValue, out maxZeroBlockValue); ComputeBitStats(p, out bitLength, out zeroCountValue, out maxZeroBlockValue);
zf = (double)zeroCountValue / bitLength; zf = (double)zeroCountValue / bitLength;
if (_zeroFracHard >= 0) if (_zeroFracHard >= 0)
@@ -1644,7 +1644,7 @@ internal static class Program
var primesPow2 = PrimesGenerator.SmallPrimesPow2; var primesPow2 = PrimesGenerator.SmallPrimesPow2;
int len = primes.Length; int len = primes.Length;
int primeIndex = 0; int primeIndex = 0;
bool divisible = false; bool divisible;
for (; primeIndex < len; primeIndex++) for (; primeIndex < len; primeIndex++)
{ {
if (primesPow2[primeIndex] > p) if (primesPow2[primeIndex] > p)
@@ -1675,12 +1675,12 @@ internal static class Program
int msbIndex = (bitLen - 1) >> 3; // 0..7 int msbIndex = (bitLen - 1) >> 3; // 0..7
int bitsInTopByte = ((bitLen - 1) & 7) + 1; // 1..8 int bitsInTopByte = ((bitLen - 1) & 7) + 1; // 1..8
int currentRun = 0; int currentRun = 0;
byte inspectedByte = 0; byte inspectedByte;
int zeroCountInByte = 0; int zeroCountInByte;
int prefixZeros = 0; int prefixZeros;
int suffixZeros = 0; int suffixZeros;
int maxZeroRunInByte = 0; int maxZeroRunInByte;
int candidate = 0; int candidate;
int byteIndex = msbIndex; int byteIndex = msbIndex;
for (; byteIndex >= 0; byteIndex--) for (; byteIndex >= 0; byteIndex--)
@@ -1742,15 +1742,15 @@ internal static class Program
static Program() static Program()
{ {
int valueIndex = 0; int valueIndex = 0;
int zeros = 0; int zeros;
int pref = 0; int pref;
int suff = 0; int suff;
int maxIn = 0; int maxIn;
int run = 0; int run;
int bit = 0; int bit;
bool isZero = false; bool isZero;
int boundaryCounter = 0; int boundaryCounter;
int boundaryBitIndex = 0; int boundaryBitIndex;
for (; valueIndex < 256; valueIndex++) for (; valueIndex < 256; valueIndex++)
{ {
zeros = 0; zeros = 0;