Skip to content

Commit

Permalink
Automatic conversion for integer operations in binary circuits.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed Oct 27, 2022
1 parent f5ed84c commit aab093b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Compiler/GC/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,8 @@ def expand(self, other, expand=True):
except:
pass
res = []
if not util.is_constant(other):
other = self.coerce(other)
for y in self, other:
if isinstance(y, int):
res.append([x * sbits.get_type(m)().long_one()
Expand Down Expand Up @@ -1230,7 +1232,6 @@ def elements(self):
def __add__(self, other):
if util.is_zero(other):
return self
other = self.coerce(other)
a, b = self.expand(other)
v = sbitint.bit_adder(a, b)
return self.get_type(len(v)).from_vec(v)
Expand Down

0 comments on commit aab093b

Please sign in to comment.