[commit: containers] : bitcount source reference (0e43f11)
Ian Lynagh
igloo at earth.li
Thu Feb 23 01:13:44 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/containers
On branch :
http://hackage.haskell.org/trac/ghc/changeset/0e43f11acced853f96fa7d8a4a68efd7744b3797
>---------------------------------------------------------------
commit 0e43f11acced853f96fa7d8a4a68efd7744b3797
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Sun Sep 18 17:14:23 2011 +0200
bitcount source reference
>---------------------------------------------------------------
Data/DenseIntSet.hs | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/Data/DenseIntSet.hs b/Data/DenseIntSet.hs
index d500a18..a8ffdd2 100644
--- a/Data/DenseIntSet.hs
+++ b/Data/DenseIntSet.hs
@@ -1199,7 +1199,15 @@ highestBitSet n0 =
----------------------------------------------------------------------}
{----------------------------------------------------------------------
- [bitcount] as posted by David F. Place to haskell-cafe on April 11, 2006
+ [bitcount] as posted by David F. Place to haskell-cafe on April 11, 2006,
+ based on the code on
+ http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan,
+ where the following source is given:
+ Published in 1988, the C Programming Language 2nd Ed. (by Brian W.
+ Kernighan and Dennis M. Ritchie) mentions this in exercise 2-9. On April
+ 19, 2006 Don Knuth pointed out to me that this method "was first published
+ by Peter Wegner in CACM 3 (1960), 322. (Also discovered independently by
+ Derrick Lehmer and published in 1964 in a book edited by Beckenbach.)"
----------------------------------------------------------------------}
bitcount :: Int -> Word -> Int
bitcount a 0 = a
More information about the Cvs-libraries
mailing list