Skip to content

Commit

Permalink
Change 'Mtbdd::_=(...)' operators to reuse binary and assignment oper…
Browse files Browse the repository at this point in the history
…ators

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
  • Loading branch information
SSoelvsten committed Apr 12, 2024
1 parent 0c6fd08 commit ae66358
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/sylvan_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ae66358

Please sign in to comment.