diff options
author | Peter Trommler <ptrommler@acm.org> | 2019-01-05 15:48:23 +0100 |
---|---|---|
committer | Peter Trommler <ptrommler@acm.org> | 2019-01-05 15:48:23 +0100 |
commit | 7070bceed6ae9448c290987ded6d8e6132c0797e (patch) | |
tree | ce25fb4d176d03d9643f6f8cd4d899c92fec6972 | |
parent | 513aa2b8f06ea8499392e60408bd0753e018d9ed (diff) | |
download | haskell-wip/improve-pext-pdep.tar.gz |
Add references to Hacker's Delightwip/improve-pext-pdep
-rw-r--r-- | libraries/ghc-prim/cbits/pdep.c | 6 | ||||
-rw-r--r-- | libraries/ghc-prim/cbits/pext.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/libraries/ghc-prim/cbits/pdep.c b/libraries/ghc-prim/cbits/pdep.c index 2769008f67..52325ff21d 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 2cac9a4f79..27894fdd3c 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) { |