From 5d9c9511f50df5b47bbc6bbb1ae8c2b61cd603f3 Mon Sep 17 00:00:00 2001 From: Nicolas Kruse Date: Sun, 19 Oct 2025 22:21:54 +0200 Subject: [PATCH] stencil c code fixed --- tools/generate_stencils.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/generate_stencils.py b/tools/generate_stencils.py index d9ef772..a5f0c1a 100644 --- a/tools/generate_stencils.py +++ b/tools/generate_stencils.py @@ -64,8 +64,7 @@ def get_op_code_float(op: str, type1: str, type2: str) -> str: def get_pow(type1: str, type2: str) -> str: return f""" {stencil_func_prefix}void pow_{type1}_{type2}({type1} arg1, {type2} arg2) {{ - ret = math_pow((double)arg1, (double)arg2); - result_float_{type2}((float)ret); + result_float_{type2}((float)math_pow((double)arg1, (double)arg2), arg2); }} """ @@ -145,7 +144,7 @@ if __name__ == "__main__": // Auto-generated stencils for copapy // Do not edit manually - void math_pow(double arg1, double arg2); + double math_pow(double arg1, double arg2); volatile int dummy_int = 1337; volatile float dummy_float = 1337; @@ -158,15 +157,15 @@ if __name__ == "__main__": for t1 in types: code += get_result_stubs1(t1) - for t1, t2 in permutate(types, types): - t_out = 'int' if t1 == 'float' else 'float' - code += get_cast(t1, t2, t_out) - for t1, t2 in permutate(types, types): code += get_result_stubs2(t1, t2) code += get_aux_funcs() + for t1, t2 in permutate(types, types): + t_out = 'int' if t1 == 'float' else 'float' + code += get_cast(t1, t2, t_out) + for op, t1, t2 in permutate(ops, types, types): t_out = t1 if t1 == t2 else 'float' if op == 'floordiv':