bitlib提供5.1版本下位操作符(c 语言实现,跨平台)

bitlib是一个库,用C语言编写,旨在为Lua 5.1版本提供跨平台的位操作功能。它包括了如按位与、按位或、按位异或、左移、右移等操作符。所有函数参数必须为整数,并且由于使用通常的8字节IEEE浮点数,因此位操作的有效位数为53位。
摘要由CSDN通过智能技术生成



在LuaForge中提供bitlib可以在lua5.1版本中提高为操作符运算。bitlib通过c语言来实现跨平台位操作符。


Lua functions provided:


bit.bnot(a)       returns the one's complement of a
bit.band(w1,...)  returns the bitwise and of the w's
bit.bor(w1,...)   returns the bitwise or of the w's
bit.bxor(w1,...)  returns the bitwise exclusive or of the w's
bit.lshift(a,b)   returns a shifted left b places
bit.rshift(a,b)   returns a shifted logically right b places
bit.arshift(a,b)  returns a shifted arithmetically right b places
bit.mod(a,b)      returns the integer remainder of a divided by b


All function arguments should be integers. 
The number of bits available for logical operations depends on the data type used to represent Lua numbers;
this is typically 8-byte IEEE floats, which give 53 bits (the size of the mantissa).
在bitlib中所有位操作的参数为整数。
位操作中有效

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值