From 591d96ebbe072c19bc0a4307b8f37901daa4b9db Mon Sep 17 00:00:00 2001 From: lyon Date: Sat, 27 Nov 2021 21:58:09 +0800 Subject: [PATCH] adding operator fo vm --- src/PikaVM.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/PikaVM.c b/src/PikaVM.c index 25538d7ed..59766732d 100644 --- a/src/PikaVM.c +++ b/src/PikaVM.c @@ -209,6 +209,18 @@ Arg* pikaVM_runInstruct(PikaObj* self, outArg = arg_setInt(outArg, "", num1 / num2); goto OPT_exit; } + if (strEqu("%", data)) { + outArg = arg_setInt(outArg, "", num1 % num2); + goto OPT_exit; + } + if (strEqu("**", data)) { + int res = 1; + for (int i = 0; i < num2; i++) { + res *= num1; + } + outArg = arg_setInt(outArg, "", res); + goto OPT_exit; + } if (strEqu("<", data)) { outArg = arg_setInt(outArg, "", num1 < num2); goto OPT_exit;