The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bit::Fast - A set of fast bit manupulation routines

SYNOPSIS

  use Bit::Fast qw(popcount popcountl);
  my $count = popcount(33);
  print $count, "\n";               # prints 2

  # 8-byte integer value:
  $count = popcountl(33 << 33);
  print $count, "\n";               # prints 2

DESCRIPTION

The goal of this module is provide fast bit manipulation routines.

popcount($v)

Returns the number of 1-bits in $v. Works on 32-bit integers.

popcountl($v)

Returns the number of 1-bits in $v. Works on 64-bit integers. (This function is not provided on 32-bits builds of perl.)

AUTHOR

Dmitri Tikhonov, <dmitri@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2015 by Dmitri Tikhonov

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.