3 ms·
avoid floats (fixed point arithmetic saved quite a bit of space) Can someone help me understand how this works? I thought JavaScript uses doubles for everythin
by chongli 3y ago
avoid floats (fixed point arithmetic saved quite a bit of space)
Can someone help me understand how this works? I thought JavaScript uses doubles for everything. Is WASM completely different in this regard?
- colejohnson66 3y agoYes. WASM has proper integer and floating-point types.
- wongarsu 3y agoAnd even JavaScript only conceptually uses doubles everywhere, JavaScript engines do use integers where they get away with it. Your loop counter is almost certainly an int. You can use this to your advantage for optimization purposes if you carefully craft your statements to probably fit in integers (e.g. by adding bitwise operations)
- deleted 3y ago[deleted]
- flohofwoe 3y agoWASM has 32-bit and 64-bit integer and float types: https://webassembly.github.io/spec/core/syntax/types.html https://webassembly.github.io/spec/core/syntax/types.html (...and additionally can load/store 8- and 16-bit integers).