Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A bitarray class for Ruby, implemented as a C extension.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 ext
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README
Octocat-spinner-32 Rakefile
Octocat-spinner-32 TODO
Octocat-spinner-32 VERSION
Octocat-spinner-32 bitarray.gemspec
README
A bit array class for Ruby, implemented as a C extension. Includes methods for
setting and clearing individual bits, and all bits at once. Also has the
standard array access methods, [] and []=, and it mixes in Enumerable.

Example usage:

    require 'bitarray'
    bm = BitArray.new(16)
    bm[5] = 1
    bm.toggle_all_bits
    puts bm
    
    bm = BitArray.new("10010110")
    bm.toggle_bit 3
    bm.clear_bit 0


The test/ directory has a unit test file, and benchmarking utility.

The examples/ directory has bloom filter dictionary-lookup demonstration.

This library has been compiled and tested on:
    
    ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux]  (Ubuntu from src)
    ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]       (Ubuntu apt-get)
    ruby 1.8.7 (2008-08-11 patchlevel 72) [alpha-netbsd]

If you have success using it on any other version/platform combinations, I'd
like to know. Or if you have problems, I'd like to know that too. Report bugs
at http://github.com/ingramj/bitarray/issues


BitArray is available as a gem. Install it with

sudo gem install ingramj-bitarray -s http://gems.github.com

Alternately, you can clone the repository and build things manually.

See the TODO file for current limitations and plans.

See the LICENSE file for copyright and license information.

Some inspiration was taken from Peter Cooper's BitField class, and various Open
Source bitarray implementations found online, but this implementation contains
only original code, except for some parts for test.rb, which were modified from
BitField's unit test file.

BitField: http://snippets.dzone.com/posts/show/4234
Something went wrong with that request. Please try again.