Skip to content

Commit

Permalink
rename wrap256
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Sep 12, 2023
1 parent 11c11c3 commit 5095452
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions boa/vyper/ir_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ def executor(cls):
def _wrap256(x):
return x % 2**256

def wrap256(x_str):

def wrap256_str(x_str):
return f"(({x_str}) % 2**256)"


Expand All @@ -424,12 +425,12 @@ def funcname(self):
return self._op.__module__ + "." + self._op.__name__

def _compile(self, x, y):
return wrap256(f"{self.funcname}({x}, {y})")
return wrap256_str(f"{self.funcname}({x}, {y})")


class SignedBinopExecutor(UnsignedBinopExecutor):
def _compile(self, x, y):
return wrap256(f"{self.funcname}(_as_signed({x}), _as_signed({y}))")
return wrap256_str(f"{self.funcname}(_as_signed({x}), _as_signed({y}))")


# for binops, just use routines from vyper optimizer
Expand Down Expand Up @@ -458,7 +459,7 @@ class Sar(IRExecutor):

def _compile(self, bits, val):
# wrap256 to get back into unsigned land
return wrap256(f"_as_signed({val}) >> {bits}")
return wrap256_str(f"_as_signed({val}) >> {bits}")


@executor
Expand All @@ -468,7 +469,7 @@ class Shl(IRExecutor):
_type: type = int

def _compile(self, bits, val):
return wrap256(f"{val} << {bits}")
return wrap256_str(f"{val} << {bits}")


@executor
Expand Down

0 comments on commit 5095452

Please sign in to comment.