From d28f63818d8c7537881ff148f285b2d6c5dca1c9 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 1 Apr 2025 22:18:02 +0300 Subject: use newly exposed ejit_sqrtr_f --- deps/ejit | 2 +- src/main.c | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/deps/ejit b/deps/ejit index 449c23e..478c92b 160000 --- a/deps/ejit +++ b/deps/ejit @@ -1 +1 @@ -Subproject commit 449c23ebc32eb45f8a6360c472bfbf5db6cd132f +Subproject commit 478c92b425eca53a0d884fb8f5dea8d769016858 diff --git a/src/main.c b/src/main.c index 6f18e9e..fd586c9 100644 --- a/src/main.c +++ b/src/main.c @@ -30,13 +30,6 @@ enum op { OP_SQRT }; -static float escape_sqrt(size_t argc, const struct ejit_arg args[argc]) -{ - assert(argc == 1); - assert(args[0].type == EJIT_FLOAT); - return sqrtf(args[0].f); -} - static const char *skip_whitespace(const char *line) { while (*line && isspace(*line)) @@ -241,11 +234,7 @@ static size_t compile_line(struct ejit_func *kernel, const char *line) case OP_SQRT: { size_t arg = 0; line = parse_var(line, &arg); - /* unfortunately no built-in operation for sqrt so we have to do - * an expensive call */ - struct ejit_operand op = EJIT_OPERAND_FPR(arg, EJIT_FLOAT); - ejit_escapei_f(kernel, escape_sqrt, 1, &op); - ejit_retval_f(kernel, EJIT_FPR(out)); + ejit_sqrtr_f(kernel, EJIT_FPR(out), EJIT_FPR(arg)); break; } -- cgit v1.2.3