[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: bit32 for Lua 5.1?
- From: Sean Bolton <sean@...>
- Date: Tue, 18 Jan 2011 11:59:43 -0800
On Jan 18, 2011, at 7:31 AM, Luiz Henrique de Figueiredo wrote:
Thanks! Preliminary tests show it works fine. I also wrote a rockspec
for it called "bit32 5.2.0alpha" for Lua 5.1. After a few more
testing
I'll post it to the LuaRocks repository.
Like I said, it was a simple hack for 32-bit Linux. Before it's
ready for
prime time, I think you need to include some #defines in lbitlib.c
like
those in the 5.2 luaconf.h for the proper definition of lua_Unsigned.
Yes, be careful. LHF's "simple hack" patch fails a number of the tests
in the lua 5.2.0 alpha test suite (in bitwise.lua). In particular, in
some of the tests, the most significant bit is lost.
Here's a version of the bit32 library from 5.2.0-alpha, fully back-
ported
to 5.1.4, with all the needed #defines and such:
http://smbolton.com/lua/lbitlib-5.2.0-alpha-backport1.c
It passes all the bitwise.lua tests on my linux x86 and Mac OS X PPC
systems. Hisham, feel free to incorporate anything useful from it into
your version; it's all MIT licensed (actually, the only thing original
I wrote were a few comments.)
Cheers,
-Sean