diff options
Diffstat (limited to 'libraries/ghc-bignum/src/GHC/Num/Backend/FFI.hs')
-rw-r--r-- | libraries/ghc-bignum/src/GHC/Num/Backend/FFI.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libraries/ghc-bignum/src/GHC/Num/Backend/FFI.hs b/libraries/ghc-bignum/src/GHC/Num/Backend/FFI.hs index 3fddd19098..98350d4d29 100644 --- a/libraries/ghc-bignum/src/GHC/Num/Backend/FFI.hs +++ b/libraries/ghc-bignum/src/GHC/Num/Backend/FFI.hs @@ -596,3 +596,19 @@ integer_gcde = Native.integer_gcde -- for now we use Native's implementation. If some FFI backend user needs a -- specific implementation, we'll need to determine a prototype to pass and -- return BigNat signs and sizes via FFI. + + +-- | Computes the modular inverse of two non-zero integers. +-- +-- I.e. y = integer_recip_mod x m +-- = x^(-1) `mod` m +-- +-- with 0 < y < abs m +integer_recip_mod + :: Integer + -> Integer + -> (# Integer | () #) +integer_recip_mod = Native.integer_recip_mod + -- for now we use Native's implementation. If some FFI backend user needs a + -- specific implementation, we'll need to determine a prototype to pass and + -- return BigNat signs and sizes via FFI. |