-
Notifications
You must be signed in to change notification settings - Fork 0
/
eratlib.h
43 lines (29 loc) · 944 Bytes
/
eratlib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef ERATLIB_H
#define ERATLIB_H
#include <vector>
#include <fstream>
#include <boost/dynamic_bitset.hpp>
unsigned long int load_from_file(std::vector<unsigned long int>& primes, std::ifstream& file);
class Chunk {
private:
Chunk(const Chunk&) = delete;
Chunk& operator=(Chunk const&) = delete;
boost::dynamic_bitset<>* chunk_table;
unsigned long int chunk_offset;
int chunk_size;
void set_multiple(unsigned long int n);
public:
Chunk(int size, unsigned long int offset) {
this->chunk_offset = offset;
this->chunk_size = size;
this->chunk_table = new boost::dynamic_bitset<>(size, 0ul);
}
~Chunk() {
delete this->chunk_table;
}
void forward() {
this->chunk_offset += this->chunk_size;
}
std::vector<unsigned long int> process(const std::vector<unsigned long int>& primes);
};
#endif //ERATLIB_H