P is for Practical  
PerlMonks 
comment on 
( #3333=superdoc: print w/replies, xml )  Need Help?? 
Dana replaced popcnt with mpu_popcount_string in Math::Prime::Util v0.62. I moved the native popcnt to util.h. mpu_popcount_string is a new function to handle bigints or sufficiently magic input without using a bigint library. It's faster than getting Math::BigInt involved until the numbers get over 500 digits. It should be optimized, but it's not exactly the common case. It's also useful for making sure we don't get really slow for 64bit numbers on a 32bit Perl. Not as fast as forcing 64bit code, but that's further narrowing down the space  people on 64bit machines who install a 32bit Perl. Using Math::BigInt to handle a long digit string would be something like: where only the last part is needed if it's already a bigint. Math::GMPz has Rmpz_popcount which is ridiculously fast if the input is already a Math::GMPz object. In reply to Re^2: How to do popcount (aka Hamming weight) in Perl
by danaj

