mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-08-18 02:10:31 +03:00
Address review comments
This commit is contained in:
parent
3b9eafbc91
commit
3892615998
@ -47,12 +47,6 @@ module Cryptol.PrimeEC
|
|||||||
) where
|
) 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 GHC.Num.Compat (BigNat#)
|
||||||
import qualified GHC.Num.Compat as BN
|
import qualified GHC.Num.Compat as BN
|
||||||
import GHC.Exts
|
import GHC.Exts
|
||||||
|
@ -52,6 +52,9 @@ import GHC.Exts
|
|||||||
bigNatToInteger :: BigNat# -> Integer
|
bigNatToInteger :: BigNat# -> Integer
|
||||||
bigNatToInteger = Integer.integerFromBigNat#
|
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 :: Integer -> Integer -> Maybe Integer
|
||||||
integerRecipMod x y =
|
integerRecipMod x y =
|
||||||
case Integer.integerRecipMod# x (Integer.integerToNaturalClamp y) of
|
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.Jp# b) = b
|
||||||
integerToBigNat (GMP.Jn# 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 :: Integer -> Integer -> Maybe Integer
|
||||||
integerRecipMod x y
|
integerRecipMod x y
|
||||||
| res == 0 = Nothing
|
| res == 0 = Nothing
|
||||||
|
Loading…
Reference in New Issue
Block a user