Browse Source

video_core/expr: Supply operator!= along with operator==

Provides logical symmetry to the interface.
nce_cpp
Lioncash 6 years ago
parent
commit
844d714085
  1. 14
      src/video_core/shader/expr.cpp
  2. 19
      src/video_core/shader/expr.h

14
src/video_core/shader/expr.cpp

@ -22,12 +22,24 @@ bool ExprAnd::operator==(const ExprAnd& b) const {
return (*operand1 == *b.operand1) && (*operand2 == *b.operand2); return (*operand1 == *b.operand1) && (*operand2 == *b.operand2);
} }
bool ExprAnd::operator!=(const ExprAnd& b) const {
return !operator==(b);
}
bool ExprOr::operator==(const ExprOr& b) const { bool ExprOr::operator==(const ExprOr& b) const {
return (*operand1 == *b.operand1) && (*operand2 == *b.operand2); return (*operand1 == *b.operand1) && (*operand2 == *b.operand2);
} }
bool ExprOr::operator!=(const ExprOr& b) const {
return !operator==(b);
}
bool ExprNot::operator==(const ExprNot& b) const { bool ExprNot::operator==(const ExprNot& b) const {
return (*operand1 == *b.operand1);
return *operand1 == *b.operand1;
}
bool ExprNot::operator!=(const ExprNot& b) const {
return !operator==(b);
} }
Expr MakeExprNot(Expr first) { Expr MakeExprNot(Expr first) {

19
src/video_core/shader/expr.h

@ -31,6 +31,7 @@ public:
explicit ExprAnd(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {} explicit ExprAnd(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {}
bool operator==(const ExprAnd& b) const; bool operator==(const ExprAnd& b) const;
bool operator!=(const ExprAnd& b) const;
Expr operand1; Expr operand1;
Expr operand2; Expr operand2;
@ -41,6 +42,7 @@ public:
explicit ExprOr(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {} explicit ExprOr(Expr a, Expr b) : operand1{std::move(a)}, operand2{std::move(b)} {}
bool operator==(const ExprOr& b) const; bool operator==(const ExprOr& b) const;
bool operator!=(const ExprOr& b) const;
Expr operand1; Expr operand1;
Expr operand2; Expr operand2;
@ -51,6 +53,7 @@ public:
explicit ExprNot(Expr a) : operand1{std::move(a)} {} explicit ExprNot(Expr a) : operand1{std::move(a)} {}
bool operator==(const ExprNot& b) const; bool operator==(const ExprNot& b) const;
bool operator!=(const ExprNot& b) const;
Expr operand1; Expr operand1;
}; };
@ -63,6 +66,10 @@ public:
return var_index == b.var_index; return var_index == b.var_index;
} }
bool operator!=(const ExprVar& b) const {
return !operator==(b);
}
u32 var_index; u32 var_index;
}; };
@ -74,6 +81,10 @@ public:
return predicate == b.predicate; return predicate == b.predicate;
} }
bool operator!=(const ExprPredicate& b) const {
return !operator==(b);
}
u32 predicate; u32 predicate;
}; };
@ -85,6 +96,10 @@ public:
return cc == b.cc; return cc == b.cc;
} }
bool operator!=(const ExprCondCode& b) const {
return !operator==(b);
}
ConditionCode cc; ConditionCode cc;
}; };
@ -96,6 +111,10 @@ public:
return value == b.value; return value == b.value;
} }
bool operator!=(const ExprBoolean& b) const {
return !operator==(b);
}
bool value; bool value;
}; };

Loading…
Cancel
Save