Project

bitfield

0.0
No commit activity in last 3 years
No release in over 3 years
This C extension wraps boost::dynamic_bitset and makes it available \ as a native Ruby class. The bitset behaves like an an array allowing only values of 0 and 1.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0
 Project Readme

BitField¶ ↑

This C extension wraps boost::dynamic_bitset and makes it available as a native Ruby class. The bitset behaves like an array allowing only values of 0 and 1. Using this extension is easy:

b = BitField.new 10 # Initializes BitField with size 10
puts b              # Prints '0000000000' where the last bit is b[0]
b[0..3] = Array.new(4) {1}  # Sets bits 0 to 3 to 1

Note that in contrast to the Ruby Array behaviour the BitField does not automatically grow in size.

Licence¶ ↑

Copyright© 2011 Fabian Becker, released under 2-clause BSD licence.