A question about mpz_popcount

Paul Zimmermann Paul.Zimmermann at loria.fr
Thu Feb 28 00:09:40 CET 2008


> I have some millions of numbers of 7296 bits (a multiple of 16). I
> would like to count the bits in each of the 16 equal parts of the
> number. For example I have one part from bit 0 to bit 456, a second
> one from bit 457 to bit ... etc. And I would like to produce a number
> b_15 b_14 ... b_0
> were each one of the bits b_j is the quantity of bits in part j.
> I know a way of doing this, but it is too slow.  Speed here is very
> important.

on http://www-rocq.inria.fr/secret/Cedric.Lauradoux/implementation/pm-eng.html
(in french) you'll find some algorithms for popcount, including a nice divide
and conquer one. You can contact Cedric Lauradoux at

Paul Zimmermann

More information about the gmp-discuss mailing list