Introduction to WebAssembly Text
|Using a Language Runtime as a WebAssembly Host Environment
4: WAT Datatypes
At the moment, there are only four WebAssembly numeric datatypes:
That’s it — just numbers…
No string datatype; no character datatype.
In fact, there isn’t even a Boolean type! 1
One very important point here concerns how you interpret integers.
A floating point number always carries a sign value, but when examining an integer, you are free to choose whether the value is interpreted as an unsigned sequence of bits, or as a two’s complement integer.
This means that when applied to integers, certain comparison instructions such as
lt must additionally state whether or not the most significant bit should be treated as the sign bit.
Don’t be concerned at the lack of a specific Boolean datatype because this is, in fact, just syntactic sugar.
In WAT, the outcome of a condition is stored simply as an
i32where zero means
false, and any non-zero value means
true. It’s that simple… ↩