stencil c code fixed

This commit is contained in:
Nicolas Kruse 2025-10-19 22:21:54 +02:00
parent 47375a2f3c
commit 5d9c9511f5
1 changed files with 6 additions and 7 deletions

View File

@ -64,8 +64,7 @@ def get_op_code_float(op: str, type1: str, type2: str) -> str:
def get_pow(type1: str, type2: str) -> str: def get_pow(type1: str, type2: str) -> str:
return f""" return f"""
{stencil_func_prefix}void pow_{type1}_{type2}({type1} arg1, {type2} arg2) {{ {stencil_func_prefix}void pow_{type1}_{type2}({type1} arg1, {type2} arg2) {{
ret = math_pow((double)arg1, (double)arg2); result_float_{type2}((float)math_pow((double)arg1, (double)arg2), arg2);
result_float_{type2}((float)ret);
}} }}
""" """
@ -145,7 +144,7 @@ if __name__ == "__main__":
// Auto-generated stencils for copapy // Auto-generated stencils for copapy
// Do not edit manually // Do not edit manually
void math_pow(double arg1, double arg2); double math_pow(double arg1, double arg2);
volatile int dummy_int = 1337; volatile int dummy_int = 1337;
volatile float dummy_float = 1337; volatile float dummy_float = 1337;
@ -158,15 +157,15 @@ if __name__ == "__main__":
for t1 in types: for t1 in types:
code += get_result_stubs1(t1) 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): for t1, t2 in permutate(types, types):
code += get_result_stubs2(t1, t2) code += get_result_stubs2(t1, t2)
code += get_aux_funcs() 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): for op, t1, t2 in permutate(ops, types, types):
t_out = t1 if t1 == t2 else 'float' t_out = t1 if t1 == t2 else 'float'
if op == 'floordiv': if op == 'floordiv':