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.
$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.
Returns the index of the first bit set in the bit-vector.
$start is given it will start the search at the given index.
Returns the index of the last bit set in the bit-vector.
$end is given it will start the search at the given index.
Copyright (C) 2010, 2012 by Salvador Fandino, <email@example.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.