Skip to content

Commit 9be2ca3

Browse files
committed
lock version to 1.4
1 parent 33a8fe6 commit 9be2ca3

File tree

4 files changed

+73
-32
lines changed

4 files changed

+73
-32
lines changed

README.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@
33
A simple bit array (or bit set, bit string, boolean vector, ... whatever) data structure for Lua written in pure C.
44

55
The data structure Bitarray stores bits (booleans) in an array in a memory-saving manner internally.
6-
One can assign value (0 or 1) to each element as well as extract values from the array.
6+
One can assign value (false or true) to each element as well as extract values from the array.
77

8-
## Install from luarocks
8+
* Array bit access using overloaded `[]` operators, concatenation with `..`, as well as `&, |, ~` for bit operations (5.3+).
9+
* Object-oriented access. Method chaining is available.
10+
* Conversion between bitarray and unsigned integers (big-endian).
11+
12+
## Install from [luarocks](https://luarocks.org/modules/cleoold/bitarray)
913
It will install the release version.
1014
```sh
1115
luarocks install bitarray
@@ -18,7 +22,16 @@ make all LUA_VERSION=5.3 # or 5.1, 5.2
1822
The generated shared library will reside in `out` folder. Unfortunately, I understand the difficulty of finding the right install path
1923
for libraries for different platforms so it is your responsibility to copy the file there. Typically it can be `/usr/local/lib/lua/5.3/`.
2024

25+
## [Documentation](https://cleoold.github.io/bitarray/doc/)
26+
Requiring [ldoc](http://stevedonovan.github.io/ldoc/), available by issuing
27+
```sh
28+
make doc
29+
```
30+
It is also available at [here](doc/index.html).
31+
2132
## Basic usage
33+
34+
Array access
2235
```lua
2336
local Bitarray = require'bitarray'
2437
local a = Bitarray.new(10)
@@ -27,9 +40,32 @@ for i = 1, #a do print(a[i]) end
2740
-- true false false false false false false false false false
2841
```
2942

30-
## [Documentation](https://cleoold.github.io/bitarray/doc/)
31-
Requiring [ldoc](http://stevedonovan.github.io/ldoc/), available by issuing
32-
```sh
33-
make doc
43+
Method chaining
44+
```lua
45+
local b = Bitarray.new(10)
46+
b:fill(true):set(1, false):set(#b, false)
47+
print(b)
48+
-- Bitarray[0,1,1,1,1,1,1,1,1,0]
3449
```
35-
It is also available at [here](doc/index.html).
50+
51+
Storing integers
52+
```lua
53+
local c1 = Bitarray.new(16):from_uint16(65535)
54+
print(c1)
55+
-- Bitarray[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
56+
local c2 = Bitarray.new(16):from_uint16(4015)
57+
print(c2)
58+
-- Bitarray[0,0,0,0,1,1,1,1,1,0,1,0,1,1,1,1]
59+
local c3 = c1 .. c2
60+
print(c3)
61+
-- Bitarray[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,1,0,1,1,1,1]
62+
print(c3:at_uint16(1))
63+
-- 65535
64+
print(c3:at_uint16(17))
65+
-- 4015
66+
print(c3:at_uint32(1))
67+
-- 4294905775
68+
```
69+
70+
## License
71+
MIT

bitarray-1.3-1.rockspec

Lines changed: 0 additions & 24 deletions
This file was deleted.

bitarray-1.4-1.rockspec

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package = "bitarray"
2+
version = "1.4-1"
3+
source = {
4+
url = "git+https://github.com/cleoold/bitarray.git",
5+
tag = "1.4"
6+
}
7+
description = {
8+
summary = "Bit array library for lua",
9+
detailed = [[
10+
A simple bit array (or bit set, bit string, boolean vector, ... whatever) data structure for Lua written in pure C.
11+
* Array bit access using overloaded `[]` operators, concatenation with `..`, as well as `&, |, ~` for bit operations (5.3+).
12+
* Object-oriented access. Method chaining is available.
13+
* Conversion between bitarray and unsigned integers (big-endian).
14+
]],
15+
homepage = "https://cleoold.github.io/bitarray/",
16+
license = "MIT"
17+
}
18+
dependencies = {
19+
"lua >= 5.1"
20+
}
21+
build = {
22+
type = "builtin",
23+
modules = {
24+
bitarray = {
25+
sources = "ext/bitarray.c"
26+
}
27+
},
28+
copy_directories = { "doc", }
29+
}

ext/bitarray.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Describes the loaded bitarray library info (version and lua version)
1717
* @string __version
1818
*/
19-
#define BITARRAY_INFO "bitarray 1.3 for " LUA_VERSION
19+
#define BITARRAY_INFO "bitarray 1.4 for " LUA_VERSION
2020

2121
#define _BITARRAY_API
2222

0 commit comments

Comments
 (0)