Skip to content

Commit

Permalink
fixed name, added to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Jan 18, 2012
1 parent 88975ad commit 416df90
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bitarray (0.0.4)
bitarray (0.0.5)

GEM
remote: http://rubygems.org/
Expand Down
33 changes: 32 additions & 1 deletion README.md
@@ -1,3 +1,34 @@
# BitArray: A fast(ish), pure Ruby bit field "type"

This is a simple rubygem wrapper for the class written by Peter Cooper and posted to dzone.
This is a simple rubygem wrapper for the class written by Peter Cooper and posted to dzone.

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

Create a bit array 1000 bits wide
```ruby ba = BitArray.new(1000)```

Setting and reading bits
```ruby
ba[100] = 1
ba[100] .. => 1
ba[100] = 0
```

More
```ruby
ba = BitArray.new(20)
[1,3,5,9,11,13,15].each { |i| ba[i] = 1 }
ba.to_s
#=> "01010100010101010000"
ba.total_set
#=> 7
```
2 changes: 1 addition & 1 deletion bitarray.gemspec
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "bit_array"
require "bitarray"

Gem::Specification.new do |s|
s.name = "bitarray"
Expand Down
File renamed without changes.

0 comments on commit 416df90

Please sign in to comment.