History log of /redis-3.2.3/deps/lua/src/lua_bit.c (Results 1 – 1 of 1)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: 8.0-m02, 6.2.16, 7.2.6, 7.4.1, 8.0-m01, 7.4.0, 7.4-rc2, 7.4-rc1, 7.2.5, 7.2.4, 7.0.15, 7.2.3, 7.2.2, 7.0.14, 6.2.14, 6.2.15, 7.2.1, 7.0.13, 7.2.0, 7.2-rc3, 7.0.12, 6.2.13, 6.0.20, 7.2-rc2, 6.0.19, 6.2.12, 7.0.11, 7.2-rc1, 7.0.10, 7.0.9, 6.2.11, 6.0.18, 6.2.10, 6.0.17, 6.2.9, 7.0.8, 7.0.7, 7.0.6, 6.2.8, 7.0.5, 7.0.4, 7.0.3, 7.0.2, 7.0.1, 7.0.0, 6.2.7, 7.0-rc3, 7.0-rc2, 7.0-rc1, 6.2.6, 6.0.16, 5.0.14, 5.0.13, 6.0.15, 6.2.5, 6.0.14, 6.2.4, 6.2.3, 6.0.13, 6.2.2, 6.2.1, 6.0.12, 5.0.12, 6.0.11, 6.2.0, 5.0.11, 6.2-rc3, 6.0.10, 6.2-rc2, 6.2-rc1, 6.0.9, 5.0.10, 6.0.8, 6.0.7, 6.0.6, 6.0.5, 6.0.4, 6.0.3, 6.0.2, 6.0.1, 6.0.0, 5.0.9, 6.0-rc4, 6.0-rc3, 5.0.8, 6.0-rc2, 6.0-rc1, 5.0.7, 5.0.6, 5.0.5, 3.2.13, 4.0.14, 5.0.4, 4.0.13, 5.0.3, 4.0.12, 5.0.2, 5.0.1, 5.0.0, 5.0-rc6, 5.0-rc5, 4.0.11, 5.0-rc4, 5.0-rc3, 5.0-rc2, 4.0.10, 3.2.12, 5.0-rc1, 4.0.9, 4.0.8, 4.0.7, 4.0.6, 4.0.5, 4.0.4, 4.0.3, 3.2.11, 4.0.2, 3.2.10, 4.0.1, 4.0.0, 3.2.9, 4.0-rc3, 3.2.8, 3.2.7, 3.2.6, 4.0-rc2, 4.0-rc1, 3.2.5, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0, 3.2.0-rc3, 3.0.7, 3.2.0-rc2, 3.2-rc1, 3.0.6, 2.8.24, 3.0.5, 2.8.23, 2.8.22, 3.0.4, 3.0.3, 3.0.2, 2.8.21, 2.8.20, 3.0.1, 3.0.0, 3.0.0-rc6, 3.0.0-rc5, 3.0.0-rc4, 3.0.0-rc3, 3.0.0-rc2, 2.8.19, 2.8.18, 3.0.0-rc1, 2.8.17, 2.8.16, 2.8.15, 2.8.14, 3.0.0-beta8, 2.8.13, 3.0.0-beta7, 2.8.12, 2.8.11, 3.0.0-beta6, 2.8.10, 3.0.0-beta5, 3.0.0-beta4, 3.0.0-beta3, 2.8.9
# 3fecb961 04-Apr-2014 Matt Stancliff <[email protected]>

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://bit

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.

show more ...