-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbinvec.h
More file actions
50 lines (41 loc) · 1.46 KB
/
binvec.h
File metadata and controls
50 lines (41 loc) · 1.46 KB
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
#ifndef BINVEC_H
#define BINVEC_H
#include <vector>
/*
BinVec Class
The purpose of this class is to encapsulate a vector of integers and create
functionality that will allow me to treat it like a single binary number.
*/
class BinVec
{
friend void GenBin(BinVec &x, BinVec &y, BinVec &N, int n);
public:
BinVec();
virtual ~BinVec();
BinVec(const BinVec& other);
BinVec(const char* input);
BinVec& operator=(const BinVec& other);
BinVec& operator+=(const BinVec& other);
const BinVec operator+(const BinVec& other);
BinVec& operator-=(const BinVec& other);
const BinVec operator-(const BinVec& other);
BinVec& operator*=(const BinVec& other);
const BinVec operator*(const BinVec& other);
const BinVec BinDiv(const BinVec& y, BinVec& r);
const BinVec BinMod(BinVec& y, BinVec& N);
bool operator==(const BinVec& other) const;
bool operator<(const BinVec& other) const;
bool operator<=(const BinVec& other) const;
bool operator>(const BinVec& other) const;
bool operator>=(const BinVec& other) const;
// Accessors
std::vector<int> getOperand();
char* getBinary();
const unsigned long long getDec();
// Mutators
protected:
private:
std::vector<int> operand;
};
void GenBin(BinVec &x, BinVec &y, BinVec &N, int n);
#endif // BINVEC_H