lua-users home
lua-l archive

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


On Thu, Feb 6, 2020 at 3:18 PM Hisham wrote:
> LuaJIT 2.1 does support 64-bit bitops.

Are the semantics identical to the 5.3 64-bit bitops, and if not could
you give a summary of (or a pointer to where I can learn about) the
differences?

In LuaJIT 2.1 "bit" library can work with 64-bit values
Example:
x = bit.bxor(x, y, 123ULL)


suppose I wanted to make a bit64 library with Lua 5.3 and
LuaJIT implementations

Using a "bit64" library in Lua 5.3
function bit64.bor(a,b) return a|b end
would be 10 times slower than native 5.3 code.

The only sane way I see to make a script for both
Lua 5.3 and LuaJIT is to include two versions of the script
in one lua file and choose version-specific branch in runtime.

But your idea to write an automatic translator is very interesting.
I've never thought in this direction.