From 1cde295c543e209c3b81256b50e77f3c5132a4ad Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Fri, 25 Sep 2020 18:29:21 +0200 Subject: Bignum: add bigNatFromWordArray Reimplementation of integer-gmp's byteArrayToBigNat# --- libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libraries/integer-gmp/src') 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) -- cgit v1.2.1