From 50ad74558566af897db6d7a999101e40ee544108 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 5 Oct 2019 08:37:39 -0400 Subject: [PATCH] video_core/expr: Supply operator!= along with operator== Provides logical symmetry to the interface. --- src/video_core/shader/expr.cpp | 14 +++++++++++++- src/video_core/shader/expr.h | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) 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 { return (*operand1 == *b.operand1) && (*operand2 == *b.operand2); } +bool ExprAnd::operator!=(const ExprAnd& b) const { + return !operator==(b); +} + bool ExprOr::operator==(const ExprOr& b) const { return (*operand1 == *b.operand1) && (*operand2 == *b.operand2); } +bool ExprOr::operator!=(const ExprOr& b) const { + return !operator==(b); +} + 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) { 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: 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; Expr operand1; Expr operand2; @@ -41,6 +42,7 @@ public: 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; Expr operand1; Expr operand2; @@ -51,6 +53,7 @@ public: explicit ExprNot(Expr a) : operand1{std::move(a)} {} bool operator==(const ExprNot& b) const; + bool operator!=(const ExprNot& b) const; Expr operand1; }; @@ -63,6 +66,10 @@ public: return var_index == b.var_index; } + bool operator!=(const ExprVar& b) const { + return !operator==(b); + } + u32 var_index; }; @@ -74,6 +81,10 @@ public: return predicate == b.predicate; } + bool operator!=(const ExprPredicate& b) const { + return !operator==(b); + } + u32 predicate; }; @@ -85,6 +96,10 @@ public: return cc == b.cc; } + bool operator!=(const ExprCondCode& b) const { + return !operator==(b); + } + ConditionCode cc; }; @@ -96,6 +111,10 @@ public: return value == b.value; } + bool operator!=(const ExprBoolean& b) const { + return !operator==(b); + } + bool value; };