From bafbf5959aefbe6cc0436fb38570bb9a8d31551e Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Mon, 11 Jan 2021 12:56:12 +0900 Subject: [PATCH] /mod must be unsigned --- others/planck.c | 4 ++-- others/planck.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/others/planck.c b/others/planck.c index 88dc066..86f4dd6 100644 --- a/others/planck.c +++ b/others/planck.c @@ -148,8 +148,8 @@ defcode("f", find_) { push((cell) find(pop())); next(); } defcode("v", argv_) { push((cell) saved_argv); push(saved_argc); next(); } defcode("V", impl) { push((cell) VERSION); next(); } defcode("/", divmod) { - intptr_t b = pop(); - intptr_t a = pop(); + uintptr_t b = pop(); + uintptr_t a = pop(); push(a%b); push(a/b); next(); diff --git a/others/planck.py b/others/planck.py index bcf02b5..379ec1e 100644 --- a/others/planck.py +++ b/others/planck.py @@ -226,8 +226,8 @@ def litstring(ip, np): return next(np + CELL + read(np)) add_operator('S', litstring) def divmod(): - b = ctypes.c_int(pop()).value - a = ctypes.c_int(pop()).value + b = pop() + a = pop() push(a%b) push(a//b) add_simple_operator('/', divmod)