Bit::Util - Utility subroutines for bit-vector manipulation
use Bit::Util qw(bu_count bu_last bu_first); my $vec = "foobardoz"; my $cnt = bu_count($vec); my $first = bu_first($vec); my $last = bu_last($vec);
This module provides some utility methods for bit-vector handling.
It is writting in XS and so its aim is to be very fast.
Counts the number of bits set in the bit-vector.
$start and $end, when given, allows to select a sub range of bits inside the bit-vector. The bits at offsets bigger or equal than $start and smaller than $end will be counted.
$start
$end
Returns the index of the first bit set in the bit-vector.
If $start is given it will start the search at the given index.
Returns the index of the last bit set in the bit-vector.
If $end is given it will start the search at the given index.
"vec" in perlfunc
Salvador Fandino
Copyright (C) 2010, 2012 by Salvador Fandino, <sfandino@yahoo.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.
To install Bit::Util, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bit::Util
CPAN shell
perl -MCPAN -e shell install Bit::Util
For more information on module installation, please visit the detailed CPAN module installation guide.