summaryrefslogtreecommitdiff
path: root/libraries/integer-gmp
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-09-30 17:43:10 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-02 13:52:38 -0400
commit12c06927a03a2fdb516f7008c57d68568b02b576 (patch)
treec01860d5708f449e96722e4fa45d5dd992e03d28 /libraries/integer-gmp
parent3c9beab75aaa5fbbb11132c99e2af114f322152f (diff)
downloadhaskell-12c06927a03a2fdb516f7008c57d68568b02b576.tar.gz
Bignum: implement integerRecipMod (#18427)
Diffstat (limited to 'libraries/integer-gmp')
-rw-r--r--libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs b/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs
index a501196e67..cc1068ba10 100644
--- a/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs
+++ b/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs
@@ -32,6 +32,7 @@ module GHC.Integer.GMP.Internals
, gcdExtInteger
, lcmInteger
, sqrInteger
+ , recipModInteger
-- ** Additional conversion operations to 'Integer'
, wordToNegInteger
@@ -186,6 +187,12 @@ lcmInteger = I.integerLcm
sqrInteger :: Integer -> Integer
sqrInteger = I.integerSqr
+{-# DEPRECATED recipModInteger "Use integerRecipMod# instead" #-}
+recipModInteger :: Integer -> Integer -> Integer
+recipModInteger x m = case I.integerRecipMod# x m of
+ (# y | #) -> y
+ (# | () #) -> 0
+
{-# DEPRECATED wordToNegInteger "Use integerFromWordNeg# instead" #-}
wordToNegInteger :: Word# -> Integer
wordToNegInteger = I.integerFromWordNeg#