Proposal: Add Data.Bits.popCount

Daniel Fischer daniel.is.fischer at googlemail.com
Wed Aug 17 23:58:17 CEST 2011


First,

+1 for a popCount primitive

On Wednesday 17 August 2011, 22:33:29, Johan Tibell wrote:
> On Wed, Aug 17, 2011 at 7:44 PM, Maciej Marcin Piechotka
> 
> <uzytkownik2 at gmail.com> wrote:
> > I posted bug for various similar instructions some time ago:
> > 
> > http://hackage.haskell.org/trac/ghc/ticket/4102
> > 
> > Probably the update should be done in batch (i.e. popCount,
> > trailing/leading zeros etc.)

Very desirable to have these too.

> 
> I'd be happy to see these as well. If someone would like to do the GHC
> work needed to have them translate into single machine instructions
> where available, have a look at the implementation of the popCnt#
> primops here:
> 

I intend to see whether I can learn from those how to do it, but

>    
> https://github.com/ghc/ghc/commit/2d0438f329ac153f9e59155f405d27fac0c43
> d65
> https://github.com/ghc/packages-ghc-prim/commit/cefc19afafe5107ff98d520
> 5c204b190da1d497b
> https://github.com/ghc/testsuite/commit/2f4d13348e2140f7fc0d4b8b995a2be
> 0fa6291f0
> 
> I don't have time to do so at the moment.

nor have I, no time for hacking before September :(

> 
> I'd prefer to not wait with adding popCount until this is done, unless
> someone takes it on them to add the others before GHC 7.4.

No, don't wait. While it would be nice to have the others equally soon, 
it's better to have one goody than none.

Cheers,
Daniel



More information about the Libraries mailing list