Skip to content

Commit 430e8ba

Browse files
committed
doc twiddle
1 parent 416df90 commit 430e8ba

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,34 @@
33
This is a simple rubygem wrapper for the class written by Peter Cooper and posted to dzone.
44

55
## History
6-
v5 (added support for flags being on by default, instead of off)
7-
# v4 (fixed bug where setting 0 bits to 0 caused a set to 1)
8-
# v3 (supports dynamic bitwidths for array elements.. now doing 32 bit widths default)
9-
# v2 (now uses 1 << y, rather than 2 ** y .. it's 21.8 times faster!)
10-
# v1 (first release)
11-
#
12-
# Description
6+
- v5 (added support for flags being on by default, instead of off)
7+
- v4 (fixed bug where setting 0 bits to 0 caused a set to 1)
8+
- v3 (supports dynamic bitwidths for array elements.. now doing 32 bit widths default)
9+
- v2 (now uses 1 << y, rather than 2 ** y .. it's 21.8 times faster!)
10+
- v1 (first release)
11+
12+
## Description
1313
Basic, pure Ruby bit array. Pretty fast (for what it is) and memory efficient.
1414
Works well for Bloom filters (the reason I wrote it).
1515

1616
Create a bit array 1000 bits wide
17-
```ruby ba = BitArray.new(1000)```
17+
```ruby
18+
ba = BitArray.new(1000)
19+
```
1820

1921
Setting and reading bits
2022
```ruby
21-
ba[100] = 1
22-
ba[100] .. => 1
23-
ba[100] = 0
23+
ba[100] = 1
24+
ba[100] .. => 1
25+
ba[100] = 0
2426
```
2527

2628
More
2729
```ruby
28-
ba = BitArray.new(20)
29-
[1,3,5,9,11,13,15].each { |i| ba[i] = 1 }
30-
ba.to_s
31-
#=> "01010100010101010000"
32-
ba.total_set
33-
#=> 7
30+
ba = BitArray.new(20)
31+
[1,3,5,9,11,13,15].each { |i| ba[i] = 1 }
32+
ba.to_s
33+
#=> "01010100010101010000"
34+
ba.total_set
35+
#=> 7
3436
```

0 commit comments

Comments
 (0)