-
Notifications
You must be signed in to change notification settings - Fork 0
/
big_int.hpp
66 lines (40 loc) · 1.3 KB
/
big_int.hpp
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// big_int.hpp
// Fusion Tree
//
// Created by Rogerio Aristida Guimaraes Junior on 1/31/18.
//
#ifndef big_int_hpp
#define big_int_hpp
#include <stdio.h>
#include <bitset>
#define PSIZE 4000 // Number of bits printed in cout << big_int
#define PINTERV 100 // Number of bits in printing intervals
#define WSIZE 4000 // Size the big_int must have - O(max(K^5+K^4,w+sqrt(w))
class big_int {
private:
std::bitset<WSIZE> bs;
public:
operator int() const;
int word_size() const;
big_int(int x = 0);
big_int(const std::bitset<WSIZE> &b);
big_int operator~() const;
big_int operator-() const;
bool operator<(const big_int x) const;
bool operator<=(const big_int x) const;
bool operator>(const big_int x) const;
bool operator>=(const big_int x) const;
bool operator==(const big_int x) const;
bool operator!=(const big_int x) const;
big_int operator<<(const int x) const;
big_int operator>>(const int x) const;
big_int operator|(const big_int x) const;
big_int operator&(const big_int x) const;
big_int operator^(const big_int x) const;
big_int operator+(const big_int x) const;
big_int operator-(const big_int x) const;
big_int operator*(const big_int x) const;
};
std::ostream &operator<<(std::ostream &out, const big_int &bi);
#endif /* big_int_hpp */