Closed mikeyyuen closed 4 years ago
You are right. Up to now I had mostly been using LuaJIT and Debian’s build of Lua 5.3, which still has bit32 built in. I am not sure there is a clean way of having a portable implementation which can either make use of the Lua 5.3 bitwise operators or use the bit/bit32 libraries on other versions of Lua. Mostly because the bitwise operators lead to syntax errors where not available.
In the meantime I have just created a lua5.3 branch with a quick fix so that it works on Lua 5.3 using the bitwise operators.
Thanks for the branch, yes thats a good point backwards compatibility would require conditionally loading code, which is probably messy.
I Merged the two versions of the code into master branch. Proper selection of the implementation is done at run time.
It looks like Lua 5.3 deprecates bit32 in favour of integer bitwise operators in 64 bits (unless compiled in compatibility mode). I took a quick look at doing something like
It looks like integer overflow might be handled differently (due to 64 / 32 bits) so I wasn't sure if that was safe, or if it might make this library faster to use all 64 bits, any thoughts on a good way to handle platforms without bit32?