Skip to content

Commit

Permalink
Fix bugs in binary memory access.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed Jul 22, 2024
1 parent d4933d1 commit 5c4382c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Compiler/GC/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ def __init__(self, other=None, size=None):
@classmethod
def load_mem(cls, address, size=None):
if isinstance(address, int) or len(address) == 1:
address = [address + i for i in range(size or 1)]
address = [address + i * cls.mem_size()
for i in range(size or 1)]
else:
assert size == None
return cls(
Expand All @@ -799,9 +800,7 @@ def store_in_mem(self, address):
for x in self.v:
if not util.is_constant(x):
size = max(size, x.n)
if isinstance(address, int):
address = range(address, address + size)
elif len(address) == 1:
if isinstance(address, int) or len(address) == 1:
address = [address + i * self.mem_size()
for i in range(size)]
else:
Expand Down

0 comments on commit 5c4382c

Please sign in to comment.