From b138e0296b7b7e6357208ebe6695349cf86efe2a Mon Sep 17 00:00:00 2001 From: luboslenco Date: Thu, 11 Jun 2026 20:33:33 +0200 Subject: [PATCH] base: update kong --- base/sources/kong/kong_metal.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/base/sources/kong/kong_metal.c b/base/sources/kong/kong_metal.c index b5b0ba04..3ebbd127 100644 --- a/base/sources/kong/kong_metal.c +++ b/base/sources/kong/kong_metal.c @@ -791,8 +791,15 @@ static void write_functions(char *code, size_t *offset) { } case OPCODE_MOD: { indent(code, offset, indentation); - *offset += sprintf(&code[*offset], "%s _%" PRIu64 " = fmod(_%" PRIu64 ", _%" PRIu64 ");\n", type_string(o->op_binary.result.type.type), - o->op_binary.result.index, o->op_binary.left.index, o->op_binary.right.index); + type_id base_type = vector_base_type(o->op_binary.result.type.type); + if (base_type == int_id || base_type == uint_id) { + *offset += sprintf(&code[*offset], "%s _%" PRIu64 " = _%" PRIu64 " %% _%" PRIu64 ";\n", type_string(o->op_binary.result.type.type), + o->op_binary.result.index, o->op_binary.left.index, o->op_binary.right.index); + } + else { + *offset += sprintf(&code[*offset], "%s _%" PRIu64 " = fmod(_%" PRIu64 ", _%" PRIu64 ");\n", type_string(o->op_binary.result.type.type), + o->op_binary.result.index, o->op_binary.left.index, o->op_binary.right.index); + } break; } default: