关于lua的位运算

785 views
Skip to first unread message

damacheng009

unread,
Jun 25, 2012, 2:18:26 AM6/25/12
to openresty
哈咯:
项目里有用到位运算,比如左移右移什么的,发现Lua没有内置的运算符,请问咱们的项目里有相关的模块可以调用吗?
 
2012-06-25

damacheng009

agentzh

unread,
Jun 25, 2012, 2:22:12 AM6/25/12
to open...@googlegroups.com
Hello!

On Mon, Jun 25, 2012 at 2:18 PM, damacheng009 <damach...@gmail.com> wrote:
> 项目里有用到位运算,比如左移右移什么的,发现Lua没有内置的运算符,请问咱们的项目里有相关的模块可以调用吗?
>

LuaJIT 2.0 中内置了 bit 库:

http://bitop.luajit.org/

它也有提供和标准 Lua 5.1 解释器一起使用的独立的 Lua 库版本,但性能差很多。

Regards,
-agentzh

agentzh

unread,
Jun 25, 2012, 2:23:56 AM6/25/12
to open...@googlegroups.com
2012/6/25 agentzh <age...@gmail.com>:

>
> LuaJIT 2.0 中内置了 bit 库:
>
>    http://bitop.luajit.org/
>

这个链接是供标准 Lua 5.1 解释器所使用的独立的 Lua 库。LuaJIT 2.0 内置的 bit 库的文档在这里:

http://luajit.org/extensions.html

Regards,
-agentzh

Reply all
Reply to author
Forward
0 new messages