Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definition of wasm_functype_new_x_y helpers - use of a macro prevents coding errors when extending. #142

Closed
adv-sw opened this issue May 8, 2020 · 1 comment

Comments

@adv-sw
Copy link

adv-sw commented May 8, 2020

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(&params, ARRAY_LENGTH(ps), ps);
wasm_valtype_vec_new(&results, ARRAY_LENGTH(rs), rs);
....

@rossberg
Copy link
Member

rossberg commented Aug 6, 2020

I believe this is implemented/superseded by #145.

@rossberg rossberg closed this as completed Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants