From 468a12204110aa9594ed202f7ef6673d205b1e75 Mon Sep 17 00:00:00 2001 From: Kim Walisch Date: Sun, 23 Jun 2024 11:07:00 +0200 Subject: [PATCH] Refactor --- include/Sieve.hpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/include/Sieve.hpp b/include/Sieve.hpp index e5352898..fde78ff1 100644 --- a/include/Sieve.hpp +++ b/include/Sieve.hpp @@ -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 + void pre_sieve(const Vector& 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) { @@ -125,21 +140,6 @@ class Sieve #endif } - template - void pre_sieve(const Vector& 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)