[Git][ghc/ghc][master] Bignum: add missing compat import/export functions

Marge Bot gitlab at gitlab.haskell.org
Wed Sep 2 19:56:56 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
85e62123 by Sylvain Henry at 2020-09-02T15:56:48-04:00
Bignum: add missing compat import/export functions

- - - - -


1 changed file:

- libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs


Changes:

=====================================
libraries/integer-gmp/src/GHC/Integer/GMP/Internals.hs
=====================================
@@ -57,9 +57,6 @@ module GHC.Integer.GMP.Internals
     , bigNatToInt
     , bigNatToWord
     , indexBigNat#
-    , importBigNatFromByteArray
-    , exportBigNatToMutableByteArray
-
 
       -- ** 'BigNat' arithmetic operations
     , plusBigNat
@@ -112,9 +109,17 @@ module GHC.Integer.GMP.Internals
 
       -- ** Export
     , exportBigNatToAddr
+    , exportIntegerToAddr
+
+    , exportBigNatToMutableByteArray
+    , exportIntegerToMutableByteArray
 
       -- ** Import
     , importBigNatFromAddr
+    , importIntegerFromAddr
+
+    , importBigNatFromByteArray
+    , importIntegerFromByteArray
     ) where
 
 import GHC.Integer
@@ -373,6 +378,18 @@ exportBigNatToAddr (BN# b) addr endian = IO \s ->
    case B.bigNatToAddr# b addr endian s of
       (# s', w #) -> (# s', W# w #)
 
+{-# DEPRECATED importIntegerFromAddr "Use integerFromAddr# instead" #-}
+importIntegerFromAddr :: Addr# -> Word# -> Int# -> IO Integer
+importIntegerFromAddr addr sz endian = IO \s ->
+   case I.integerFromAddr# sz addr endian s of
+      (# s', i #) -> (# s', i #)
+
+{-# DEPRECATED exportIntegerToAddr "Use integerToAddr# instead" #-}
+exportIntegerToAddr :: Integer -> Addr# -> Int# -> IO Word
+exportIntegerToAddr i addr endian = IO \s ->
+   case I.integerToAddr# i addr endian s of
+      (# s', w #) -> (# s', W# w #)
+
 wordToBigNat :: Word# -> BigNat
 wordToBigNat w = BN# (B.bigNatFromWord# w)
 
@@ -398,3 +415,13 @@ importBigNatFromByteArray ba off sz endian = case runRW# (B.bigNatFromByteArray#
 exportBigNatToMutableByteArray :: BigNat -> MutableByteArray# RealWorld -> Word# -> Int# -> IO Word
 exportBigNatToMutableByteArray (BN# ba) mba off endian = IO (\s -> case B.bigNatToMutableByteArray# ba mba off endian s of
    (# s', r #) -> (# s', W# r #))
+
+{-# DEPRECATED importIntegerFromByteArray "Use integerFromByteArray# instead" #-}
+importIntegerFromByteArray :: ByteArray# -> Word# -> Word# -> Int# -> Integer
+importIntegerFromByteArray ba off sz endian = case runRW# (I.integerFromByteArray# sz ba off endian) of
+   (# _, r #) -> r
+
+{-# DEPRECATED exportIntegerToMutableByteArray "Use integerToMutableByteArray# instead" #-}
+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 #))



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/85e621234916e9b5d40174831a3b422bd99f8f83

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/85e621234916e9b5d40174831a3b422bd99f8f83
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200902/96d35184/attachment-0001.html>


More information about the ghc-commits mailing list