diff options
author | Matt Stancliff <matt@genges.com> | 2014-04-04 11:34:36 -0400 |
---|---|---|
committer | Matt Stancliff <matt@genges.com> | 2014-10-09 11:51:30 -0400 |
commit | 3fecb96122e35cb0c5809699c26eb093efda19e8 (patch) | |
tree | 186c4d9f92bdf0d0ae8d2f408fb7fb1d03cac494 /deps/lua/src/Makefile | |
parent | 5ba47b50ae6ea5e0ed56598d0ef33dc43c6a7abf (diff) | |
download | redis-3fecb96122e35cb0c5809699c26eb093efda19e8.tar.gz |
Lua: Add bitop
A few people have written custom C commands because bit
manipulation isn't exposed through Lua. Let's give
them Mike Pall's bitop.
This adds bitop 1.0.2 (2012-05-08) from http://bitop.luajit.org/
bitop is imported as "bit" into the global namespace.
New Lua commands: bit.tobit, bit.tohex, bit.bnot, bit.band, bit.bor, bit.bxor,
bit.lshift, bit.rshift, bit.arshift, bit.rol, bit.ror, bit.bswap
Verification of working (the asserts would abort on error, so (nil) is correct):
127.0.0.1:6379> eval "assert(bit.tobit(1) == 1); assert(bit.band(1) == 1); assert(bit.bxor(1,2) == 3); assert(bit.bor(1,2,4,8,16,32,64,128) == 255)" 0
(nil)
127.0.0.1:6379> eval 'assert(0x7fffffff == 2147483647, "broken hex literals"); assert(0xffffffff == -1 or 0xffffffff == 2^32-1, "broken hex literals"); assert(tostring(-1) == "-1", "broken tostring()"); assert(tostring(0xffffffff) == "-1" or tostring(0xffffffff) == "4294967295", "broken tostring()")' 0
(nil)
Tests also integrated into the scripting tests and can be run with:
./runtest --single unit/scripting
Tests are excerpted from `bittest.lua` included in the bitop distribution.
Diffstat (limited to 'deps/lua/src/Makefile')
-rw-r--r-- | deps/lua/src/Makefile | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/deps/lua/src/Makefile b/deps/lua/src/Makefile index 34b0c3617..ecd6a6990 100644 --- a/deps/lua/src/Makefile +++ b/deps/lua/src/Makefile @@ -27,7 +27,8 @@ CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ lundump.o lvm.o lzio.o strbuf.o LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \ - lstrlib.o loadlib.o linit.o lua_cjson.o lua_struct.o lua_cmsgpack.o + lstrlib.o loadlib.o linit.o lua_cjson.o lua_struct.o lua_cmsgpack.o \ + lua_bit.o LUA_T= lua LUA_O= lua.o |