From d7390e3706d22f0e22421f8ffb2b37636977c546 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Thu, 15 Jun 2023 00:31:22 +0800 Subject: [PATCH] ... --- src/pocketpy.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pocketpy.h b/src/pocketpy.h index 85575e0a..2668a1bf 100644 --- a/src/pocketpy.h +++ b/src/pocketpy.h @@ -117,7 +117,8 @@ inline void init_builtins(VM* _vm) { _vm->bind_builtin_func<2>("divmod", [](VM* vm, ArgsView args) { i64 lhs = CAST(i64, args[0]); i64 rhs = CAST(i64, args[1]); - return VAR(Tuple({VAR(lhs/rhs), VAR(lhs%rhs)})); + std::ldiv_t res = std::div(lhs, rhs); + return VAR(Tuple({VAR(res.quot), VAR(res.rem)})); }); _vm->bind_builtin_func<1>("eval", [](VM* vm, ArgsView args) {