1 /// 2 /// @file EratBig.hpp 3 /// 4 /// Copyright (C) 2020 Kim Walisch, <kim.walisch@gmail.com> 5 /// 6 /// This file is distributed under the BSD License. See the COPYING 7 /// file in the top level directory. 8 /// 9 10 #ifndef ERATBIG_HPP 11 #define ERATBIG_HPP 12 13 #include "Bucket.hpp" 14 #include "macros.hpp" 15 #include "MemoryPool.hpp" 16 #include "Wheel.hpp" 17 18 #include <stdint.h> 19 #include <vector> 20 21 namespace primesieve { 22 23 /// EratBig is an implementation of the segmented sieve of 24 /// Eratosthenes optimized for big sieving primes that have 25 /// very few multiples per segment. 26 /// 27 class EratBig : public Wheel210_t 28 { 29 public: 30 void init(uint64_t, uint64_t, uint64_t); 31 NOINLINE void crossOff(uint8_t*); enabled() const32 bool enabled() const { return enabled_; } 33 private: 34 uint64_t maxPrime_ = 0; 35 uint64_t log2SieveSize_ = 0; 36 uint64_t moduloSieveSize_ = 0; 37 std::vector<SievingPrime*> buckets_; 38 MemoryPool memoryPool_; 39 bool enabled_ = false; 40 void storeSievingPrime(uint64_t, uint64_t, uint64_t); 41 NOINLINE void crossOff(uint8_t*, Bucket*); 42 }; 43 44 } // namespace 45 46 #endif 47