From ae663581eaa0aaea6948ef8c4a1cb4b101d8cd51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffan=20S=C3=B8lvsten?= Date: Sat, 13 Apr 2024 00:03:08 +0200 Subject: [PATCH] Change 'Mtbdd::_=(...)' operators to reuse binary and assignment operators This way, the code for dealing with protection is only taken care of in a single place. Furthermore, there are no code-duplications for the meaning of each operator. Finally, the assignment should use the new move-assignment --- src/sylvan_obj.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/sylvan_obj.cpp b/src/sylvan_obj.cpp index fc4199f5..3d4a69a6 100644 --- a/src/sylvan_obj.cpp +++ b/src/sylvan_obj.cpp @@ -782,8 +782,7 @@ Mtbdd::operator*(const Mtbdd& other) const Mtbdd& Mtbdd::operator*=(const Mtbdd& other) { - mtbdd = mtbdd_times(mtbdd, other.mtbdd); - return *this; + return (*this = *this * other); } Mtbdd @@ -795,8 +794,7 @@ Mtbdd::operator+(const Mtbdd& other) const Mtbdd& Mtbdd::operator+=(const Mtbdd& other) { - mtbdd = mtbdd_plus(mtbdd, other.mtbdd); - return *this; + return (*this = *this + other); } Mtbdd @@ -808,8 +806,7 @@ Mtbdd::operator-(const Mtbdd& other) const Mtbdd& Mtbdd::operator-=(const Mtbdd& other) { - mtbdd = mtbdd_minus(mtbdd, other.mtbdd); - return *this; + return (*this = *this - other); } Mtbdd