[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Possible bug in MS_ASMTRICK? (Lua 5.2)
- From: KHMan <keinhong@...>
- Date: Mon, 22 Apr 2013 10:42:22 +0800
On 4/22/2013 10:11 AM, Coda Highland wrote:
On Sun, Apr 21, 2013 at 6:45 PM, KHMan wrote:
On 4/22/2013 4:26 AM, [ex] wrote:
I'm using Lua 5.2 as the foundation of my own language (Killa).
alert(9.9 | 0); // Alerts 9. (x|0) is used a lot in JS to
the code in Lua:
print(bit32.bor(9.9, 0)) -- prints 10, not 9
do so. Non-integers for a bitwise function? This is like texting while
Just use math.floor in Lua.
This *is* the way JS fixed it. Bitwise operations coerce to integer,
and x|0 is a lot faster than Math.floor(x), plus also the bitop gives
JIT optimizers a very powerful hint that the value is an integer and
will probably always be one.
not surprised ;-)
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia