forked from data61/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBit.h
73 lines (61 loc) · 1.12 KB
/
Bit.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
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
/*
* Bit.h
*
*/
#ifndef MATH_BIT_H_
#define MATH_BIT_H_
#include "BitVec.h"
template<class T> class gf2n_;
class Bit : public BitVec_<bool>
{
typedef BitVec_<bool> super;
public:
static int size_in_bits()
{
return 1;
}
Bit()
{
}
Bit(int other) :
super(other)
{
assert(other == 0 or other == 1);
}
Bit(const super::super& other) :
super(other)
{
}
Bit(char*)
{
throw runtime_error("never call this");
}
template<class T>
Bit(const gf2n_<T>& other);
Bit operator*(const Bit& other) const
{
return super::operator*(other);
}
template<class T>
T operator*(const T& other) const
{
return other * *this;
}
void pack(octetStream& os, int = -1) const
{
super::pack(os, 1);
}
void unpack(octetStream& os, int = -1)
{
super::unpack(os, 1);
}
void operator>>=(int)
{
throw runtime_error("never call this");
}
void operator<<=(int)
{
throw runtime_error("never call this");
}
};
#endif /* MATH_BIT_H_ */