blob: 29a274026075e907795f0d2823eb1bffb2f5a233 (
plain)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#pragma once
#include <stdint.h>
#include <Exceptions.h>
#include <BString.h>
namespace Balau {
class BigInt {
public:
BigInt() throw(GeneralException);
BigInt(const BigInt &) throw (GeneralException);
BigInt(BigInt &&);
~BigInt();
BigInt & operator=(const BigInt &) throw (GeneralException);
void set(uint64_t) throw (GeneralException);
void set(int64_t);
void set(uint32_t) throw (GeneralException);
void set(int32_t);
void set(double) throw (GeneralException);
void set(const String &, int radix = 10) throw (GeneralException);
void set2expt(int i) throw (GeneralException);
BigInt operator+(unsigned int) const throw (GeneralException);
BigInt operator+(const BigInt &) const throw (GeneralException);
BigInt operator-(unsigned int) const throw (GeneralException);
BigInt operator-(const BigInt &) const throw (GeneralException);
BigInt operator*(unsigned int) const throw (GeneralException);
BigInt operator*(const BigInt &) const throw (GeneralException);
BigInt operator/(const BigInt &) const throw (GeneralException);
BigInt operator%(const BigInt &) const throw (GeneralException);
BigInt operator<<(unsigned int) const throw (GeneralException);
BigInt operator>>(unsigned int) const;
BigInt & operator+=(unsigned int) throw (GeneralException);
BigInt & operator+=(const BigInt &) throw (GeneralException);
BigInt & operator-=(unsigned int) throw (GeneralException);
BigInt & operator-=(const BigInt &) throw (GeneralException);
BigInt & operator*=(unsigned int) throw (GeneralException);
BigInt & operator*=(const BigInt &) throw (GeneralException);
BigInt & operator/=(const BigInt &) throw (GeneralException);
BigInt & operator%=(const BigInt &) throw (GeneralException);
BigInt & operator<<=(unsigned int) throw (GeneralException);
BigInt & operator>>=(unsigned int);
BigInt operator-() const throw (GeneralException);
BigInt & operator++();
BigInt operator++(int);
BigInt & operator--();
BigInt operator--(int);
enum comp_t { LT, GT, EQ };
comp_t comp(const BigInt &) const throw (GeneralException);
comp_t comp(unsigned int) const throw (GeneralException);
BigInt & neg() throw (GeneralException);
BigInt sqrt() const throw (GeneralException);
BigInt & do_sqrt() throw (GeneralException);
BigInt gcd(const BigInt &) const throw (GeneralException);
BigInt lcm(const BigInt &) const throw (GeneralException);
bool operator==(unsigned int) const;
bool operator==(const BigInt &) const;
bool operator!=(unsigned int) const;
bool operator!=(const BigInt &) const;
bool operator<=(unsigned int) const;
bool operator<=(const BigInt &) const;
bool operator>=(unsigned int) const;
bool operator>=(const BigInt &) const;
bool operator<(unsigned int) const;
bool operator<(const BigInt &) const;
bool operator>(unsigned int) const;
bool operator>(const BigInt &) const;
BigInt modadd(const BigInt & a, const BigInt & m) const throw (GeneralException);
BigInt modsub(const BigInt & a, const BigInt & m) const throw (GeneralException);
BigInt modmul(const BigInt & a, const BigInt & m) const throw (GeneralException);
BigInt modsqr(const BigInt & m) const throw (GeneralException);
BigInt modinv(const BigInt & m) const throw (GeneralException);
BigInt modpow(const BigInt & a, const BigInt & m) const throw (GeneralException);
BigInt & do_modadd(const BigInt & a, const BigInt & m) throw (GeneralException);
BigInt & do_modsub(const BigInt & a, const BigInt & m) throw (GeneralException);
BigInt & do_modmul(const BigInt & a, const BigInt & m) throw (GeneralException);
BigInt & do_modsqr(const BigInt & m) throw (GeneralException);
BigInt & do_modinv(const BigInt & m) throw (GeneralException);
BigInt & do_modpow(const BigInt & a, const BigInt & m) throw (GeneralException);
bool isPrime() const;
String toString(int radix = 10) const;
char * makeString(int radix = 10) const;
private:
void * m_bi = NULL;
};
};
|