diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-07-30 17:30:09 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-08-05 03:59:27 -0400 |
commit | d613ed7624cbf39192d2a8cf29ab0c0fd2980a15 (patch) | |
tree | 1964352c495487b60af77aff5b5c2379019e4ac9 /libraries/ghc-bignum/src/GHC | |
parent | ef2ae81a394df573510b12b7e11bba0c931249d8 (diff) | |
download | haskell-d613ed7624cbf39192d2a8cf29ab0c0fd2980a15.tar.gz |
Bignum: add backward compat integer-gmp functions
Also enhance bigNatCheck# and isValidNatural test
Diffstat (limited to 'libraries/ghc-bignum/src/GHC')
-rw-r--r-- | libraries/ghc-bignum/src/GHC/Num/BigNat.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/ghc-bignum/src/GHC/Num/BigNat.hs b/libraries/ghc-bignum/src/GHC/Num/BigNat.hs index 4aeedafc9d..8b5b4d31e3 100644 --- a/libraries/ghc-bignum/src/GHC/Num/BigNat.hs +++ b/libraries/ghc-bignum/src/GHC/Num/BigNat.hs @@ -80,6 +80,10 @@ data BigNat = BN# { unBigNat :: BigNat# } bigNatCheck# :: BigNat# -> Bool# bigNatCheck# bn | 0# <- bigNatSize# bn = 1# + -- check that size is a multiple of Word size + | r <- remInt# (sizeofByteArray# bn) WORD_SIZE_IN_BYTES# + , isTrue# (r /=# 0#) = 0# + -- check that most-significant limb isn't zero | 0## <- bigNatIndex# bn (bigNatSize# bn -# 1#) = 0# | True = 1# |