Address review comments

This commit is contained in:
Ryan Scott 2022-01-25 17:03:03 -05:00
parent 3b9eafbc91
commit 3892615998
2 changed files with 6 additions and 6 deletions

View File

@ -47,12 +47,6 @@ module Cryptol.PrimeEC
) where
{-
import GHC.Num.BigNat (BigNat#)
import qualified GHC.Num.Backend as BN
import qualified GHC.Num.BigNat as BN
import qualified GHC.Num.Integer as BN
-}
import GHC.Num.Compat (BigNat#)
import qualified GHC.Num.Compat as BN
import GHC.Exts

View File

@ -52,6 +52,9 @@ import GHC.Exts
bigNatToInteger :: BigNat# -> Integer
bigNatToInteger = Integer.integerFromBigNat#
-- | @'integerRecipMod' x m@ computes the modular inverse of @x@ mod @m@.
--
-- PRECONDITION: @m@ must be strictly positive.
integerRecipMod :: Integer -> Integer -> Maybe Integer
integerRecipMod x y =
case Integer.integerRecipMod# x (Integer.integerToNaturalClamp y) of
@ -134,6 +137,9 @@ integerToBigNat (GMP.S# i) = GMP.wordToBigNat (int2Word# i)
integerToBigNat (GMP.Jp# b) = b
integerToBigNat (GMP.Jn# b) = b
-- | @'integerRecipMod' x m@ computes the modular inverse of @x@ mod @m@.
--
-- PRECONDITION: @m@ must be strictly positive.
integerRecipMod :: Integer -> Integer -> Maybe Integer
integerRecipMod x y
| res == 0 = Nothing