[commit: ghc] wip/improve-pext-pdep: Add references to Hacker's Delight (7070bce)

git at git.haskell.org git at git.haskell.org
Sun Jan 6 09:26:48 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/improve-pext-pdep
Link       : http://ghc.haskell.org/trac/ghc/changeset/7070bceed6ae9448c290987ded6d8e6132c0797e/ghc

>---------------------------------------------------------------

commit 7070bceed6ae9448c290987ded6d8e6132c0797e
Author: Peter Trommler <ptrommler at acm.org>
Date:   Sat Jan 5 15:48:23 2019 +0100

    Add references to Hacker's Delight


>---------------------------------------------------------------

7070bceed6ae9448c290987ded6d8e6132c0797e
 libraries/ghc-prim/cbits/pdep.c | 6 ++++++
 libraries/ghc-prim/cbits/pext.c | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/libraries/ghc-prim/cbits/pdep.c b/libraries/ghc-prim/cbits/pdep.c
index 2769008..52325ff 100644
--- a/libraries/ghc-prim/cbits/pdep.c
+++ b/libraries/ghc-prim/cbits/pdep.c
@@ -1,6 +1,12 @@
 #include "Rts.h"
 #include "MachDeps.h"
 
+/*
+ * The algorithm for PDEP or generalized insert or expand is from
+ * Henry S. Warren, Hacker's Delight, 2nd ed, p 157, Figure 7-12
+ * "Parallel suffix method for the /expand/ operation".
+ */
+
 StgWord64
 hs_pdep64(StgWord64 src, StgWord64 mask)
 {
diff --git a/libraries/ghc-prim/cbits/pext.c b/libraries/ghc-prim/cbits/pext.c
index 2cac9a4..27894fd 100644
--- a/libraries/ghc-prim/cbits/pext.c
+++ b/libraries/ghc-prim/cbits/pext.c
@@ -1,6 +1,12 @@
 #include "Rts.h"
 #include "MachDeps.h"
 
+/*
+ * The algorithm for PEXT or generalized extract or compress is from
+ * Henry S. Warren, Hacker's Delight, 2nd ed, p 153, Figure 7-10
+ * "Parallel suffix method for the /compress/ operation".
+ */
+
 StgWord64
 hs_pext64(StgWord64 src, StgWord64 mask)
 {



More information about the ghc-commits mailing list