diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-11-02 15:24:38 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-11-09 11:10:17 -0500 |
commit | bba8f79c7e933c312ca251469b99d0ac99954e16 (patch) | |
tree | f82b197c71f75ad1b154c6230b63801c67c66643 | |
parent | 3d7f5ec8232d9053b192cb94b19c5d5e85bc46f4 (diff) | |
download | haskell-bba8f79c7e933c312ca251469b99d0ac99954e16.tar.gz |
Bignum: make GMP's bignat_add not recursive
bignat_add was a loopbreaker with an INLINE pragma (spotted by
@mpickering). This patch makes it non recursive to avoid the issue.
(cherry picked from commit bff74de713dac3e62c3bb6f1946e0649549f2215)
-rw-r--r-- | libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs b/libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs index 8db1dd57b2..649a7acc70 100644 --- a/libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs +++ b/libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs @@ -70,13 +70,13 @@ bignat_add -> State# RealWorld {-# INLINE bignat_add #-} bignat_add mwa wa wb s - -- weird GMP requirement + -- weird GMP requirement: the biggest comes first | isTrue# (wordArraySize# wb ># wordArraySize# wa) - = bignat_add mwa wb wa s + = case ioWord# (c_mpn_add mwa wb (wordArraySize# wb) wa (wordArraySize# wa)) s of + (# s', c #) -> mwaWriteMostSignificant mwa c s' | True - = do - case ioWord# (c_mpn_add mwa wa (wordArraySize# wa) wb (wordArraySize# wb)) s of + = case ioWord# (c_mpn_add mwa wa (wordArraySize# wa) wb (wordArraySize# wb)) s of (# s', c #) -> mwaWriteMostSignificant mwa c s' bignat_add_word |