Performance wise?
I think a pre computed lookup table is the way I'd go.
An array with 2**16 entries should be a good compromise between time and memory complexity.
(Since Perl doesn't fit into a CPU's line cache)
Sorry too busy to code it for you :)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
In reply to Re: How to do popcount (aka Hamming weight) in Perl
by LanX
in thread How to do popcount (aka Hamming weight) in Perl (popcount References)
by eyepopslikeamosquito
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |