Lua Bit Operations Module

http://bitop.luajit.org/index.html

Lua BitOp is a C extension module for Lua 5.1/5.2which adds bitwise operations on numbers.

Lua BitOp is Copyright © 2008-2012 Mike Pall.Lua BitOp is free software, released under theMIT license(same license as the Lua core).

Features

  • Supported functions:bit.tobit, bit.tohex, bit.bnot, bit.band, bit.bor, bit.bxor,bit.lshift, bit.rshift, bit.arshift, bit.rol, bit.ror, bit.bswap
  • Consistent semanticsacross 16, 32 and 64 bit platforms.
  • Supports different lua_Number types:either IEEE 754 doubles, int32_t or int64_t.
  • Runs on Linux, *BSD, Mac OS X, Windows and probably anything elseyou can find.
  • Simple installation on all systems.No bulky configure scripts. Embedded-systems-friendly.
  • Internal self-test on startup to detect miscompiles.Includes a comprehensive test and benchmark suite.
  • Compatible with the built-in bitwise operations inLuaJIT 2.0.
  • It's as fast as you can get with the standard Lua/C API.

More ...

Please click on one of the links in the navigation bar to your leftto learn more.

Please visit the Download page to fetchthe current version of Lua BitOp.

News

2012-05-08 Lua BitOp 1.0.2 has been released

This release adds compatibility with both Lua 5.1 and Lua 5.2.

Embedding Lua BitOp

If you're embedding Lua into your application, it's quite simple toadd Lua BitOp as a static module:

1. Copy the file bit.c from the Lua BitOp distributionto your Lua source code directory.

2. Add this file to your build script (e.g. modify the Makefile) orimport it as a build dependency in your IDE.

3. Edit lualib.h and add the following two lines:

#define LUA_BITLIBNAME "bit"
LUALIB_API int luaopen_bit(lua_State *L);

4. Edit linit.c and add this immediately before the linewith {NULL, NULL}:

  {LUA_BITLIBNAME, luaopen_bit},

5. Now recompile and you're done!





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值