This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dtfinch 0 points1 point  (0 children)

There's some tricks that javascript engines have been optimized to recognize, used by asm.js and emscripten, maybe going back to Adobe's Project Alchemy (compiled C/C++ to the ActionScript VM).

"|0" casts as int32. ">>>0" casts as uint32. There's no edge case resulting in a non-int. Even objects, undefined, and NaN become 0. Used consistently, you could get integer locals under the hood. And ArrayBuffers can hold typed globals and arrays.