Home | Notifications | New Note | Local | Federated | Search | Logout

Note Detail


Reply to @mcc@mastodon.social
mcc@mcc@mastodon.social (2026-10-02 21:43:34)
So upthread, I complain that the only integer types in wasm are i32 and i64— no i8, i16 or i1. If you want to store a boolean, you use an i32.

What I didn't realize until just now is bools can *only* be i32. The test operations don't work with i64s—(if) tests if the value on top of the stack is nonzero, but that number must be an i32. If you want to test if an i64 is nonzero you have to toss in an explicit (i64.const 0) (i64.ne). Which I guess makes sense or else you'd need i32.if/i64.if but :|
---Reply--- dave@dthompson@toot.cat (2026-10-02 22:07:40) @mcc however, i8 and i16 are valid types for arrays.
Reply