From 46c6196c2c15e8e349c1e0d59a82dcd71fe7d9c3 Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Wed, 29 Dec 2021 07:41:11 +0900 Subject: [PATCH] change unit size of array of python version --- others/planck.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/others/planck.py b/others/planck.py index 553840d..86b7092 100644 --- a/others/planck.py +++ b/others/planck.py @@ -17,7 +17,7 @@ VERSION = "{}:{}".format(RUNTIME_NAME, COPYRIGHT) MEMORY_SIZE = 0x10000 -memory = array.array('i', [0]*MEMORY_SIZE) +memory = array.array('l', [0]*MEMORY_SIZE) CELL = memory.itemsize CELLm1 = CELL - 1 CELL_SHIFT = CELL.bit_length() - 1 @@ -41,10 +41,11 @@ def align(): write(HERE_CELL, aligned(read(HERE_CELL))) def read(addr): + print(addr, addr >> CELL_SHIFT) return memory[addr >> CELL_SHIFT] def write(addr, v): - memory[addr >> CELL_SHIFT] = ctypes.c_int(v).value + memory[addr >> CELL_SHIFT] = ctypes.c_long(v).value def comma(v): here = read(HERE_CELL)