Skip to content

Commit ff0985b

Browse files
authored
Merge pull request #2186 from certik/emu_fix1
Fix a bug in cptr_to_u64 in emulation
2 parents 7d147fb + 09cf64a commit ff0985b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/lpython/lpython.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,10 +773,10 @@ def __repr__(self):
773773
return ctypes_c_void_p()
774774

775775
def cptr_to_u64(cptr):
776-
return ctypes.addressof(cptr)
776+
return u64(ctypes.cast(cptr, ctypes.c_void_p).value)
777777

778778
def u64_to_cptr(ivalue):
779-
return ctypes.c_void_p(ivalue)
779+
return ctypes.c_void_p(i64(ivalue))
780780

781781
def sizeof(arg):
782782
return ctypes.sizeof(convert_type_to_ctype(arg))

0 commit comments

Comments
 (0)