summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2019-10-05 08:37:39 -0400
committerGravatar Lioncash2019-10-05 09:14:26 -0400
commit50ad74558566af897db6d7a999101e40ee544108 (patch)
tree80b6a06b14ca51550a754ee042a465ac204169d7
parentvideo_core/{ast, expr}: Use std::move where applicable (diff)
downloadyuzu-50ad74558566af897db6d7a999101e40ee544108.tar.gz
yuzu-50ad74558566af897db6d7a999101e40ee544108.tar.xz
yuzu-50ad74558566af897db6d7a999101e40ee544108.zip
video_core/expr: Supply operator!= along with operator==
Provides logical symmetry to the interface.
-rw-r--r--src/video_core/shader/expr.cpp14
-rw-r--r--src/video_core/shader/expr.h19
2 files changed, 32 insertions, 1 deletions
diff --git a/src/video_core/shader/expr.cpp b/src/video_core/shader/expr.cpp
index 39df7a927..2647865d4 100644
--- a/src/video_core/shader/expr.cpp
+++ b/src/video_core/shader/expr.cpp
@@ -22,12 +22,24 @@ bool ExprAnd::operator==(const ExprAnd& b) const {
22 return (*operand1 == *b.operand1) && (*operand2 == *b.operand2); 22 return (*operand1 == *b.operand1) && (*operand2 == *b.operand2);
23} 23}
24 24
25bool ExprAnd::operator!=(const ExprAnd& b) const {
26 return !operator==(b);
27}
28
25bool ExprOr::operator==(const ExprOr& b) const { 29bool ExprOr::operator==(const ExprOr& b) const {
26 return (*operand1 == *b.operand1) && (*operand2 == *b.operand2); 30 return (*operand1 == *b.operand1) && (*operand2 == *b.operand2);
27} 31}
28 32
33bool ExprOr::operator!=(const ExprOr& b) const {
34 return !operator==(b);
35}
36
29bool ExprNot::operator==(const ExprNot& b) const { 37bool ExprNot::operator==(const ExprNot& b) const {
30 return (*operand1 == *b.operand1); 38 return *operand1 == *b.operand1;
39}
40
41bool ExprNot::operator!=(const ExprNot& b) const {
42 return !operator==(b);
31} 43}
32 44
33Expr MakeExprNot(Expr first) { 45Expr MakeExprNot(Expr first) {
diff --git a/src/video_core/shader/expr.h b/src/video_core/shader/expr.h
index 1f1638520..45695c0ed 100644
--- a/src/video_core/shader/expr.h
+++ b/src/video_core/shader/expr.h
@@ -31,6 +31,7 @@ public:
31 explicit ExprAnd(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {} 31 explicit ExprAnd(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {}
32 32
33 bool operator==(const ExprAnd& b) const; 33 bool operator==(const ExprAnd& b) const;
34 bool operator!=(const ExprAnd& b) const;
34 35
35 Expr operand1; 36 Expr operand1;
36 Expr operand2; 37 Expr operand2;
@@ -41,6 +42,7 @@ public:
41 explicit ExprOr(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {} 42 explicit ExprOr(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {}
42 43
43 bool operator==(const ExprOr& b) const; 44 bool operator==(const ExprOr& b) const;
45 bool operator!=(const ExprOr& b) const;
44 46
45 Expr operand1; 47 Expr operand1;
46 Expr operand2; 48 Expr operand2;
@@ -51,6 +53,7 @@ public:
51 explicit ExprNot(Expr a) : operand1{std::move(a)} {} 53 explicit ExprNot(Expr a) : operand1{std::move(a)} {}
52 54
53 bool operator==(const ExprNot& b) const; 55 bool operator==(const ExprNot& b) const;
56 bool operator!=(const ExprNot& b) const;
54 57
55 Expr operand1; 58 Expr operand1;
56}; 59};
@@ -63,6 +66,10 @@ public:
63 return var_index == b.var_index; 66 return var_index == b.var_index;
64 } 67 }
65 68
69 bool operator!=(const ExprVar& b) const {
70 return !operator==(b);
71 }
72
66 u32 var_index; 73 u32 var_index;
67}; 74};
68 75
@@ -74,6 +81,10 @@ public:
74 return predicate == b.predicate; 81 return predicate == b.predicate;
75 } 82 }
76 83
84 bool operator!=(const ExprPredicate& b) const {
85 return !operator==(b);
86 }
87
77 u32 predicate; 88 u32 predicate;
78}; 89};
79 90
@@ -85,6 +96,10 @@ public:
85 return cc == b.cc; 96 return cc == b.cc;
86 } 97 }
87 98
99 bool operator!=(const ExprCondCode& b) const {
100 return !operator==(b);
101 }
102
88 ConditionCode cc; 103 ConditionCode cc;
89}; 104};
90 105
@@ -96,6 +111,10 @@ public:
96 return value == b.value; 111 return value == b.value;
97 } 112 }
98 113
114 bool operator!=(const ExprBoolean& b) const {
115 return !operator==(b);
116 }
117
99 bool value; 118 bool value;
100}; 119};
101 120