lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 4/23/2013 6:25 AM, Henk Boom wrote:
On 22 April 2013 04:01, KHMan wrote:
I have a feeling that this has already been addressed in LuaJIT...

LuaJIT defines the semantics in the same way:

http://bitop.luajit.org/semantics.html

"Non-integral numbers may be rounded or truncated in an
implementation-defined way. This means the result could differ between
different BitOp versions, different Lua VMs, on different platforms or
even between interpreted vs. compiled code (as in LuaJIT).
Avoid passing fractional numbers to bitwise functions. Use
math.floor() or math.ceil()to get defined behavior."

I apologize profusely for not making myself precisely clear there.

I meant that one can probably find the fastest x86 instructions for type conversion/floor/trunc related operations within the LuaJIT sources, in this case, see the section marked by "-- Type conversions --" in lj_asm_x86.h...

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia