Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: How to do popcount (aka Hamming weight) in Perl

by BrowserUk (Patriarch)
on Sep 24, 2017 at 14:51 UTC ( [id://1199994]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #! perl -slw
    use strict; package SparseBitVector; use Config;
    ...
       Four  => sub { popcount4($_) for $start .. $end },
       Six   => sub { popcnt(   $_) for $start .. $end },
    };
    
  2. or download this
    C:\test>1199987.pl
    sanity test for correctness
    ...
    Four  1.08/s    5%    1%    --  -56%
    Six   2.45/s  140%  131%  128%    --
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1199994]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-20 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found