Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Dec 18, 2019
1 parent 68f05b4 commit 565d48a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/PrimeGenerator.cpp
Expand Up @@ -293,7 +293,7 @@ void PrimeGenerator::fill(vector<uint64_t>& primes,

// Use local variables to prevent the compiler from
// writing temporary results to memory.
size_t num = 0;
size_t i = 0;
size_t maxSize = primes.size();
assert(maxSize >= 64);
uint64_t low = low_;
Expand All @@ -310,17 +310,17 @@ void PrimeGenerator::fill(vector<uint64_t>& primes,
uint64_t bits = littleendian_cast<uint64_t>(&sieve[sieveIdx]);

for (; bits != 0; bits &= bits - 1)
primes[num++] = nextPrime(bits, low);
primes[i++] = nextPrime(bits, low);

low += 8 * 30;
sieveIdx += 8;
}
while (num <= maxSize - 64 &&
while (i <= maxSize - 64 &&
sieveIdx < sieveSize);

low_ = low;
sieveIdx_ = sieveIdx;
*size = num;
*size = i;
}
while (*size == 0);
}
Expand Down
3 changes: 2 additions & 1 deletion src/PrintPrimes.cpp
Expand Up @@ -176,7 +176,8 @@ void PrintPrimes::printkTuplets() const
uint64_t low = low_;
ostringstream kTuplets;

for (; !ps_.isPrint(i); i++);
while (!ps_.isPrint(i))
i++;

for (uint64_t j = 0; j < sieveSize_; j++, low += 30)
{
Expand Down

0 comments on commit 565d48a

Please sign in to comment.