# Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions. # See https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt for license information. print( """// Part of the Concrete Compiler Project, under the BSD3 License with Zama // Exceptions. See // https://github.com/zama-ai/homomorphizer/blob/main/LICENSE.txt // for license information. // generated: see genDynamicArityCall.py #ifndef CONCRETELANG_SERVERLIB_DYNAMIC_ARITY_CALL_H #define CONCRETELANG_SERVERLIB_DYNAMIC_ARITY_CALL_H #include #include #include "concretelang/ClientLib/Types.h" namespace mlir { namespace serverlib { template Res multi_arity_call(Res (*func)(void *...), std::vector args) { switch (args.size()) { // TODO C17++: https://en.cppreference.com/w/cpp/utility/apply """) for i in range(1, 128): args = ','.join(f'args[{j}]' for j in range(i)) print(f' case {i}: return func({args});') print(""" default: assert(false); } }""") print(""" } // namespace concretelang } // namespace mlir #endif """)