Closed adv-sw closed 4 years ago
Suggest macro helper in the intializer as follows to make it even easier :)
static inline wasm_functype_t wasm_functype_new_5_1(wasm_valtype_t p1, wasm_valtype_t p2, wasm_valtype_t p3, wasm_valtype_t p4, wasm_valtype_t p5, wasm_valtype_t r) { wasm_valtype_t ps[5] = {p1, p2, p3, p4, p5}; wasm_valtype_t* rs[1] = {r}; wasm_valtype_vec_t params, results; wasm_valtype_vec_new(¶ms, ARRAY_LENGTH(ps), ps); wasm_valtype_vec_new(&results, ARRAY_LENGTH(rs), rs); ....
I believe this is implemented/superseded by #145.
Suggest macro helper in the intializer as follows to make it even easier :)
define ARRAY_LENGTH(x) sizeof(x)/sizeof(x[0])
static inline wasm_functype_t wasm_functype_new_5_1(wasm_valtype_t p1, wasm_valtype_t p2, wasm_valtype_t p3, wasm_valtype_t p4, wasm_valtype_t p5, wasm_valtype_t r) { wasm_valtype_t ps[5] = {p1, p2, p3, p4, p5}; wasm_valtype_t* rs[1] = {r}; wasm_valtype_vec_t params, results; wasm_valtype_vec_new(¶ms, ARRAY_LENGTH(ps), ps); wasm_valtype_vec_new(&results, ARRAY_LENGTH(rs), rs); ....