|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| AUTHORS | H A D | 05-Jan-2007 | 28 | 2 | 1 |
| COPYING | H A D | 05-Jan-2007 | 27 | 1 | 1 |
| ChangeLog | H A D | 05-Jan-2007 | 17 | 2 | 1 |
| INSTALL | H A D | 09-Nov-2007 | 9.2 KiB | 235 | 177 |
| Makefile.am | H A D | 19-Nov-2007 | 432 | 14 | 6 |
| Makefile.in | H A D | 19-Nov-2007 | 18.8 KiB | 600 | 519 |
| NEWS | H A D | 05-Jan-2007 | 46 | 2 | 1 |
| README | H A D | 16-Nov-2007 | 2.5 KiB | 71 | 50 |
| aclocal.m4 | H A D | 16-Nov-2007 | 255.1 KiB | 7,232 | 6,487 |
| config.guess | H A D | 09-Nov-2007 | 43.5 KiB | 1,517 | 1,305 |
| config.sub | H A D | 09-Nov-2007 | 32 KiB | 1,627 | 1,483 |
| configure | H A D | 16-Nov-2007 | 676.8 KiB | 21,277 | 16,911 |
| configure.ac | H A D | 16-Nov-2007 | 3.3 KiB | 118 | 101 |
| depcomp | H A D | 09-Nov-2007 | 17.2 KiB | 585 | 370 |
| install-sh | H A D | 09-Nov-2007 | 12.9 KiB | 508 | 340 |
| lbitlib.c | H A D | 03-May-2022 | 1.6 KiB | 64 | 51 |
| ltmain.sh | H A D | 11-Mar-2006 | 192.1 KiB | 6,872 | 5,424 |
| missing | H A D | 09-Nov-2007 | 10.9 KiB | 368 | 275 |
| testbit.lua | H A D | 19-Nov-2007 | 1.6 KiB | 68 | 48 |
README
1 bitlib release 24
2 -----------------
3
4 by Reuben Thomas <rrt@sc3d.org>
5 http://luaforge.net/projects/bitlib
6
7
8bitlib is a C library for Lua 5.x that provides bitwise operations. It
9is copyright Reuben Thomas 2000-2007, and is released under the MIT
10license, like Lua (see http://www.lua.org/copyright.html; it's
11basically the same as the BSD license). There is no warranty.
12
13Please report bugs and make suggestions to the email address above, or
14use the LuaForge trackers.
15
16Thanks to John Passaniti for his bitwise operations library, some of
17whose ideas I used, to Shmuel Zeigerman for the test suite, to
18Thatcher Ulrich for portability fixes, and to John Stiles for a bug
19fix.
20
21
22Installation
23------------
24
25As normal:
26
27 ./configure && make [&& make check] [&& make install]
28
29The following options may be of interest if you have Lua installed on
30non-default paths (as you are likely to on any system supporting more
31than one version of Lua):
32
33 --libdir=DIR Install shared library in this directory
34 --with-lua-prefix=DIR Lua files are in DIR
35 --with-lua-includes=DIR Lua include files are in DIR
36 --with-lua-libraries=DIR
37 Lua library files are in DIR
38 --with-lua-suffix=ARG Lua binary and library files are suffixed with ARG
39
40For example, on Debian:
41
42 ./configure --libdir=/usr/local/lib/lua/5.1 --with-lua-includes=/usr/include/lua5.1 --with-lua-suffix=5.1
43
44
45Use
46---
47
48Make sure the library is installed on your LUA_CPATH, and require it.
49
50Lua functions provided:
51
52bit.cast(a) cast a to the internally-used integer type
53bit.bnot(a) returns the one's complement of a
54bit.band(w1, ...) returns the bitwise and of the w's
55bit.bor(w1, ...) returns the bitwise or of the w's
56bit.bxor(w1, ...) returns the bitwise exclusive or of the w's
57bit.lshift(a, b) returns a shifted left b places
58bit.rshift(a, b) returns a shifted logically right b places
59bit.arshift(a, b) returns a shifted arithmetically right b places
60
61All function arguments should be integers. By default, the numbers
62used are 32-bit. This can be changed by redefining Integer and
63UInteger at the top of lbitlib.c. The type used should at most have
64the same number of bits as the mantissa of lua_Number, to avoid
65casting problems. lua_Number is typically a 64-byte IEEE float, which
66has a 53 bit mantissa.
67
68The logical operations start with "b" for "bit" to avoid clashing with
69reserved words; although "xor" isn't a reserved word, it seemed better
70to use "bxor" for consistency.
71