Skip to content

Commit

Permalink
Change 'Bdd::_=(...)' operators to reuse binary and assignment operators
Browse files Browse the repository at this point in the history
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 525f35d commit 0355ba8
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/sylvan_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ Bdd::operator*(const Bdd& other) const
Bdd&
Bdd::operator*=(const Bdd& other)
{
bdd = sylvan_and(bdd, other.bdd);
return *this;
return (*this = *this * other);
}

Bdd
Expand All @@ -108,8 +107,7 @@ Bdd::operator&(const Bdd& other) const
Bdd&
Bdd::operator&=(const Bdd& other)
{
bdd = sylvan_and(bdd, other.bdd);
return *this;
return (*this = *this & other);
}

Bdd
Expand All @@ -121,8 +119,7 @@ Bdd::operator+(const Bdd& other) const
Bdd&
Bdd::operator+=(const Bdd& other)
{
bdd = sylvan_or(bdd, other.bdd);
return *this;
return (*this = *this + other);
}

Bdd
Expand All @@ -134,8 +131,7 @@ Bdd::operator|(const Bdd& other) const
Bdd&
Bdd::operator|=(const Bdd& other)
{
bdd = sylvan_or(bdd, other.bdd);
return *this;
return (*this = *this | other);
}

Bdd
Expand All @@ -147,8 +143,7 @@ Bdd::operator^(const Bdd& other) const
Bdd&
Bdd::operator^=(const Bdd& other)
{
bdd = sylvan_xor(bdd, other.bdd);
return *this;
return (*this = *this ^ other);
}

Bdd
Expand All @@ -160,8 +155,7 @@ Bdd::operator-(const Bdd& other) const
Bdd&
Bdd::operator-=(const Bdd& other)
{
bdd = sylvan_and(bdd, sylvan_not(other.bdd));
return *this;
return (*this = *this - other);
}

Bdd
Expand Down

0 comments on commit 0355ba8

Please sign in to comment.