• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

AUTHORSH A D05-Jan-200728 21

COPYINGH A D05-Jan-200727 11

ChangeLogH A D05-Jan-200717 21

INSTALLH A D09-Nov-20079.2 KiB235177

Makefile.amH A D19-Nov-2007432 146

Makefile.inH A D19-Nov-200718.8 KiB600519

NEWSH A D05-Jan-200746 21

READMEH A D16-Nov-20072.5 KiB7150

aclocal.m4H A D16-Nov-2007255.1 KiB7,2326,487

config.guessH A D09-Nov-200743.5 KiB1,5171,305

config.subH A D09-Nov-200732 KiB1,6271,483

configureH A D16-Nov-2007676.8 KiB21,27716,911

configure.acH A D16-Nov-20073.3 KiB118101

depcompH A D09-Nov-200717.2 KiB585370

install-shH A D09-Nov-200712.9 KiB508340

lbitlib.cH A D03-May-20221.6 KiB6451

ltmain.shH A D11-Mar-2006192.1 KiB6,8725,424

missingH A D09-Nov-200710.9 KiB368275

testbit.luaH A D19-Nov-20071.6 KiB6848

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