Skip to content

Commit

Permalink
full adder optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
dakk committed Nov 14, 2023
1 parent c7b3e7b commit 6231f3e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion qlasskit/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def _half_adder(a, b): # Carry x Sum


def _full_adder(c, a, b): # Carry x Sum
return Or(And(a, b), And(b, c), And(a, c)), Xor(a, b, c)
return (a & b) ^ (a ^ b) & c, Xor(Xor(a, b), c)
#return Or(And(a, b), And(b, c), And(a, c)), Xor(Xor(a, b), c)


from .qtype import Qtype, TExp, TType # noqa: F401, E402
Expand Down

0 comments on commit 6231f3e

Please sign in to comment.