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

Provides logical symmetry to the interface.
This commit is contained in:
Lioncash 2019-10-05 08:37:39 -04:00
parent 8eb1398f8d
commit 50ad745585
2 changed files with 32 additions and 1 deletions

View file

@ -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) {

View file

@ -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;
}; };