Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Jun 23, 2024
1 parent 35d6c8c commit 468a122
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions include/Sieve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ class Sieve
void cross_off_count(uint64_t prime, uint64_t i);
static uint64_t get_segment_size(uint64_t size);

uint64_t get_total_count() const
{
return total_count_;
}

template <typename T>
void pre_sieve(const Vector<T>& primes, uint64_t c, uint64_t low, uint64_t high)
{
reset_sieve(low, high);
for (uint64_t i = 4; i <= c; i++)
cross_off(primes[i], i);

init_counter(low, high);
}

/// Count 1 bits inside [0, stop]
ALWAYS_INLINE uint64_t count(uint64_t stop)
{
Expand Down Expand Up @@ -125,21 +140,6 @@ class Sieve
#endif
}

template <typename T>
void pre_sieve(const Vector<T>& primes, uint64_t c, uint64_t low, uint64_t high)
{
reset_sieve(low, high);
for (uint64_t i = 4; i <= c; i++)
cross_off(primes[i], i);

init_counter(low, high);
}

uint64_t get_total_count() const
{
return total_count_;
}

private:

#if defined(ENABLE_DEFAULT)
Expand Down

0 comments on commit 468a122

Please sign in to comment.