
7 Sep
2012
7 Sep
'12
7:54 a.m.
On Thu, 2012-09-06 at 12:07 -0700, Johan Tibell wrote:
Have a look at the popCount implementation for e.g. Int, which are written in C and called through the FFI:
https://github.com/ghc/packages-ghc-prim/blob/master/cbits/popcnt.c
Out of interest: isn't this compiled into the popCnt# primop (and popcnt instruction on SSE4.2)? I recently noticed Data.IntSet also contains a fairly basic "bitcount" implementation [1]. Is this kept as-is for a reason, instead of using popCount from Data.Bits? Nicolas [1] https://github.com/ghc/packages-containers/blob/master/Data/IntSet/Base.hs#L...