Skip to content

Commit

Permalink
Using sfix with branching.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed Jan 17, 2021
1 parent bdc51dd commit 9e35aee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Compiler/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,8 +1280,9 @@ def _run_and_link(function, g=None):
pre = copy.copy(g)
res = function()
if g:
from .types import _single
for name, var in pre.items():
if isinstance(var, program.Tape.Register):
if isinstance(var, (program.Tape.Register, _single)):
new_var = g[name]
if id(new_var) != id(var):
new_var.link(var)
Expand Down
3 changes: 3 additions & 0 deletions Compiler/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3353,6 +3353,9 @@ def __ne__(self, other):
op.__doc__ = __eq__.__doc__
del op

def link(self, other):
self.v.link(other.v)

class _fix(_single):
""" Secret fixed point type. """
__slots__ = ['v', 'f', 'k']
Expand Down

0 comments on commit 9e35aee

Please sign in to comment.