-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bit.cpp
64 lines (51 loc) · 792 Bytes
/
Bit.cpp
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
/*
* Symbol.cpp
* new_LT
*
* Created by 刁培倫 on 2010/8/27.
* Copyright 2010 __MyCompanyName__. All rights reserved.
*
*/
#include<vector>
#include<string>
#include"CodeSim.h"
using namespace std;
namespace CodeSim {
Bit::Bit(){
value = 0;
setErased(false);
}
//template<class T>
Bit::Bit(int t){
if (t == -1) {
setErased(true);
}
else{
value = t;
setErased(false);
}
}
// template<class T>
// Bit Bit::operator=(T t){
// value = t;
// return *this;
// }
Bit Bit::operator+(Bit t){
return Bit(value ^ t.value);
}
// Bit Bit::operator*(Bit t){
// return Bit(this->value & t.value);
// }
string Bit::toString()
{
if (isErased()) {
return "*";
}
if (value) {
return "1";
}
else {
return "0";
}
}
}