summaryrefslogtreecommitdiff
path: root/libraries/integer-gmp
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-09-25 18:29:21 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-26 05:37:23 -0400
commit1cde295c543e209c3b81256b50e77f3c5132a4ad (patch)
tree0e6412746803f6e73dcc77963994fef43c2ae28e /libraries/integer-gmp
parentf08f98e821bc4b755a7b6ad3bad39ce1099c5405 (diff)
downloadhaskell-1cde295c543e209c3b81256b50e77f3c5132a4ad.tar.gz
Bignum: add bigNatFromWordArray
Reimplementation of integer-gmp's byteArrayToBigNat#
Diffstat (limited to 'libraries/integer-gmp')
-rw-r--r--libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs6
1 files changed, 6 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 3d5fabe6c0..a501196e67 100644
--- a/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs
+++ b/libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs
@@ -53,6 +53,7 @@ module GHC.Integer.GMP.Internals
-- ** Conversions to/from 'BigNat'
+ , byteArrayToBigNat#
, wordToBigNat
, wordToBigNat2
, bigNatToInt
@@ -432,3 +433,8 @@ importIntegerFromByteArray ba off sz endian = case runRW# (I.integerFromByteArra
exportIntegerToMutableByteArray :: Integer -> MutableByteArray# RealWorld -> Word# -> Int# -> IO Word
exportIntegerToMutableByteArray i mba off endian = IO (\s -> case I.integerToMutableByteArray# i mba off endian s of
(# s', r #) -> (# s', W# r #))
+
+
+{-# DEPRECATED byteArrayToBigNat# "Use bigNatFromWordArray instead" #-}
+byteArrayToBigNat# :: ByteArray# -> GmpSize# -> BigNat
+byteArrayToBigNat# ba n = B.bigNatFromWordArray ba (int2Word# n)