From 3656a1e5c9a0ec1b185a3ac23505b65470c84b2e Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Mon, 6 Dec 2021 23:03:57 +0900 Subject: [PATCH] fix previous commit --- others/planck.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/others/planck.py b/others/planck.py index 76e38c8..7b2f0c3 100644 --- a/others/planck.py +++ b/others/planck.py @@ -19,6 +19,7 @@ MEMORY_SIZE = 0x10000 memory = array.array('i', [0]*MEMORY_SIZE) CELL = memory.itemsize +CELLm1 = CELL - 1 CELL_SHIFT = CELL.bit_length() - 1 STACK_SIZE = 0x100 @@ -32,8 +33,9 @@ rp = (MEMORY_SIZE - STACK_SIZE) * CELL ip = 0 np = 0 +ALIGN_MASK = CELL - 1 def aligned(n): - return (n + CELL - 1) % CELL + return (n + CELLm1) & ALIGN_MASK def align(): write(HERE_CELL, aligned(read(HERE_CELL)))