You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally built to help power a bloom filter, although there are other higher level libraries for that task now (https://github.com/igrigorik/bloomfilter-rb is a popular one.)
BitArray has changed little over the years, but has been maintained to work within a typical, modern Ruby environment and, as of February 2024, is confirmed to work with both Ruby 3.0.1 and Ruby 3.3.0.
BitArray by default stores the bits in reverse order for each byte. If for example, you are initializing BitArray with Redis raw value manipulated with setbit / getbit operations, you will need to tell BitArray to not reverse the bits in each byte using the reverse_byte: false option:
1.3.1 in 2024 (no changes other than adding license to gemspec)
1.3 in 2022 (cleanups and a minor perf tweak)
1.2 in 2018 (Added option to skip reverse the bits for each byte by @dalibor)
1.1 in 2018 (fixed a significant bug)
1.0 in 2017 (updated for modern Ruby, more efficient storage, and 10th birthday)
0.0.1 in 2012 (original v5 released on GitHub)
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)
Thanks
Thanks to Michael Slade for encouraging me to update this library on its 10th birthday and for suggesting finally using String's getbyte and setbyte methods now that we're all on 1.9+ compatible implementations.
Further thanks to @tdeo, @JoshuaSP, @dalibor, @yegct and @m1lt0n for pull requests.