Data::BitStream::XS is a XS implementation providing read/write access to bit streams. This includes many integer coding methods as well as straightforward ways to implement new codes.
Bit streams are often used in data compression and in embedded products where memory is at a premium.
This code provides a nearly drop-in XS replacement for the Data::BitStream module. If you do not need the ability to add custom codes, or the flexibility of the Moose/Mouse system, you can use this directly.
The Data::BitStream class will attempt to use this class if it is available. Most operations will be 50-100 times faster, while not sacrificing any of its flexibility, so it is highly recommended.
There is not a lot of extra speed gained by using the XS class directly, so maximum portability and flexibility is had by using the Data::BitStream class and installing this module to get the speed.
my $stream = Data::BitStream::XS->new;
$stream->put_gamma($_) for (1 .. 20);
my @values = $stream->get_gamma(-1);