]> git.zerfleddert.de Git - proxmark3-svn/blob - client/README-bitlib
Merged with master
[proxmark3-svn] / client / README-bitlib
1 bitlib
2 ------
3
4 by Reuben Thomas <rrt@sc3d.org>
5 http://luaforge.net/projects/bitlib
6
7
8 bitlib is a C library for Lua 5.1 that provides bitwise operations. It
9 is copyright Reuben Thomas 2000-2009, and is released under the MIT
10 license, like Lua (see http://www.lua.org/copyright.html; it's
11 basically the same as the BSD license). There is no warranty.
12
13 Please report bugs and make suggestions to the email address above, or
14 use the LuaForge trackers.
15
16 Thanks to John Passaniti for his bitwise operations library, some of
17 whose ideas I used, to Shmuel Zeigerman for the test suite, to
18 Thatcher Ulrich for portability fixes, and to Enrico Tassi, John
19 Stiles and Eduardo Ochs for bug reports.
20
21
22 Installation
23 ------------
24
25 As normal:
26
27 ./configure && make [&& make check] [&& make install]
28
29 If you get warnings about integer constants being too large, don't
30 worry. They won't be used.
31
32 The following options may be of interest if you have Lua installed on
33 non-default paths (as you are likely to on any system supporting more
34 than one version of Lua):
35
36 --libdir=DIR Install shared library in this directory
37 --with-lua-prefix=DIR Lua files are in DIR
38 --with-lua-includes=DIR Lua include files are in DIR
39 --with-lua-libraries=DIR
40 Lua library files are in DIR, or "no" if not used
41 --with-lua-suffix=ARG Lua binary and library files are suffixed with ARG
42
43 For example, on Debian or Ubuntu:
44
45 ./configure --libdir=/usr/local/lib/lua/5.1 --with-lua-includes=/usr/include/lua5.1 --with-lua-suffix=5.1 --with-lua-libraries=no
46
47
48 Use
49 ---
50
51 Make sure the library is installed on your LUA_CPATH, and require it.
52
53 The library provides the constant bit.bits that gives the number of
54 bits that can be used in bitwise operations, and the following
55 functions:
56
57 bit.cast(a) cast a to the internally-used integer type
58 bit.bnot(a) returns the one's complement of a
59 bit.band(w1, ...) returns the bitwise and of the w's
60 bit.bor(w1, ...) returns the bitwise or of the w's
61 bit.bxor(w1, ...) returns the bitwise exclusive or of the w's
62 bit.lshift(a, b) returns a shifted left b places
63 bit.rshift(a, b) returns a shifted logically right b places
64 bit.arshift(a, b) returns a shifted arithmetically right b places
65
66 All function arguments should be integers that fit into the C type
67 lua_Integer.
68
69 The logical operations start with "b" for "bit" to avoid clashing with
70 reserved words; although "xor" isn't a reserved word, it seemed better
71 to use "bxor" for consistency.
Impressum, Datenschutz