=head1 NAME bit - bitwise operations (bitlib) =head1 OVERVIEW bitlib is a C library for Lua 5.x that provides bitwise operations. =head1 INSTALLATION The provided Makefile builds a shared library called bit.so, which can be installed on LUA_CPATH and used with require. =head1 REFERENCE Lua functions provided: =head2 C bit.bnot(a) returns the one's complement of C =head2 C bit.band(w1,...) returns the bitwise and of the C's =head2 C bit.bor(w1,...) returns the bitwise or of the C's =head2 C bit.bxor(w1,...) returns the bitwise exclusive or of the C's =head2 C bit.lshift(a,b) returns C shifted left C places =head2 C bit.rshift(a,b) returns C shifted logically right C places =head2 C bit.arshift(a,b) returns C shifted arithmetically right C places =head2 C bit.mod(a,b) returns the integer remainder of C divided by C =head2 Additional Notes 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). The logical operations start with "b" for "bit" to avoid clashing with reserved words; although "xor" isn't a reserved word, it seemed better to use "bxor" for consistency. =head1 VERSION This is bitlib release 21. =head1 CREDITS by Reuben Thomas L Thanks to John Passaniti for his bitwise operations library, some of whose ideas I used, and to Thatcher Ulrich for portability fixes. =head1 CONTACT Please report bugs and make suggestions to the email address above, or use the LuaForge trackers. =head1 LICENSE It is copyright Reuben Thomas 2000-2006, and is released under the MIT license, like Lua (see http://www.lua.org/copyright.html; it's basically the same as the BSD license). There is no warranty.