[commit: ghc] master: integer-gmp2: export `Word`-counterpart of gcdInt (be7fb7e)

git at git.haskell.org git at git.haskell.org
Sat Nov 22 12:23:36 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/be7fb7e58c70cd9b0a933fb26cd5f2607d6dc4b2/ghc

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

commit be7fb7e58c70cd9b0a933fb26cd5f2607d6dc4b2
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Nov 22 13:18:34 2014 +0100

    integer-gmp2: export `Word`-counterpart of gcdInt
    
    It's trivial for `integer-gmp2` (#9281) to provide it, and it'll be
    useful for a future 'Natural'-related commit, as well as providing a
    `Word` optimised `gcd`-RULE.


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

be7fb7e58c70cd9b0a933fb26cd5f2607d6dc4b2
 libraries/integer-gmp2/src/GHC/Integer/GMP/Internals.hs | 1 +
 libraries/integer-gmp2/src/GHC/Integer/Type.hs          | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/libraries/integer-gmp2/src/GHC/Integer/GMP/Internals.hs b/libraries/integer-gmp2/src/GHC/Integer/GMP/Internals.hs
index e319bee..77d73bf 100644
--- a/libraries/integer-gmp2/src/GHC/Integer/GMP/Internals.hs
+++ b/libraries/integer-gmp2/src/GHC/Integer/GMP/Internals.hs
@@ -118,6 +118,7 @@ module GHC.Integer.GMP.Internals
 
       -- * Miscellaneous GMP-provided operations
     , gcdInt
+    , gcdWord
 
       -- * Import/export functions
       -- ** Compute size of serialisation
diff --git a/libraries/integer-gmp2/src/GHC/Integer/Type.hs b/libraries/integer-gmp2/src/GHC/Integer/Type.hs
index b0864f7..48c5ed8 100644
--- a/libraries/integer-gmp2/src/GHC/Integer/Type.hs
+++ b/libraries/integer-gmp2/src/GHC/Integer/Type.hs
@@ -777,11 +777,18 @@ lcmInteger a b = (aa `quotInteger` (aa `gcdInteger` ab)) `timesInteger` ab
 
 -- | Compute greatest common divisor.
 --
--- Warning: result may become negative if (at least) one argument is 'minBound'
+-- __Warning__: result may become negative if (at least) one argument
+-- is 'minBound'
 gcdInt :: Int# -> Int# -> Int#
 gcdInt x# y#
     = word2Int# (gcdWord# (int2Word# (absI# x#)) (int2Word# (absI# y#)))
 
+-- | Compute greatest common divisor.
+--
+-- /Since: 1.0.0.0/
+gcdWord :: Word# -> Word# -> Word#
+gcdWord = gcdWord#
+
 ----------------------------------------------------------------------------
 -- BigNat operations
 



More information about the ghc-commits mailing list