4 ms·
I mean, no, not really, unless you're appending |0 to everything like a compiler would, i.e. ((a|0) / (b|0))|0. I'm not saying it's useless, asm.js used this t
by qsort 4y ago
I mean, no, not really, unless you're appending |0 to everything like a compiler would, i.e. ((a|0) / (b|0))|0.
I'm not saying it's useless, asm.js used this trick to great effect. I'm just saying that unless the situation is more complex and doing a bitwise operation actually encodes information (like the &0xff example in a sibling comment, from which the compiler can deduce "this is a uint8"), it's unlikely you're giving the compiler more information than it's already capable of deducing on its own.
- Asraelite 4y ago> unless you're appending |0 to everything like a compiler would, i.e. ((a|0) / (b|0))|0. It effectively does do that though, since earlier in your code `a` and `b` would be defined with `let a = ... |0` so now `a` and `a|0` are equivalent in any subsequent expressions.
- chrisseaton 4y agoYes - local variables are just indirections through a name - in a compiler referring to a and referring to the original ... |0 expression are the same thing. https://twitter.com/ChrisGSeaton/status/1530579735012593665 https://twitter.com/ChrisGSeaton/status/1530579735012593665
- deleted 4y ago[deleted]