本文主要是介绍bitlib提供5.1版本下位操作符(c 语言实现,跨平台),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在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中所有位操作的参数为整数。
位操作中有效
这篇关于bitlib提供5.1版本下位操作符(c 语言实现,跨平台)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!