bitop library - SquidDev-CC/CCTweaks-Lua GitHub Wiki
The bitop library provides an extended set of functions to operator on the bits of integers. It is also twice as fast as vanilla's library as it does not have to go through CC's conversion mechanism.
Examples
local value = tonumber(read())
local masked = bitop.band(0xff, value)
print(bitop.tohex(masked, 2))
Configuration
The bitop library can be enabled or disabled using the APIs.bitop config option.
Documentation
The API is modelled off of LuaJIT's bit library and so there are differences to the vanilla bit library.
- More than two values can be passed for
band,bor, andbxor. lshift,rshiftandarshiftinstead ofblshift,blogic_rshiftandbrshift(like thebit32API).- Added
tobit,tohex,rol,rorandbswap