GHC.Num.BigNat.Native

ghc-bignum-1.0: GHC BigNum library

Safe Haskell | None
Language | Haskell2010

GHC.Num.BigNat.Native

Synopsis

- count_words_bits :: Word# -> (# Word#, Word# #)
- count_words_bits_int :: Word# -> (# Int#, Int# #)
- bignat_compare :: WordArray# -> WordArray# -> Int#
- bignat_add :: MutableWordArray# s -> WordArray# -> WordArray# -> State# s -> State# s
- bignat_add_word :: MutableWordArray# RealWorld -> WordArray# -> Word# -> State# RealWorld -> State# RealWorld
- bignat_sub_word :: MutableWordArray# RealWorld -> WordArray# -> Word# -> State# RealWorld -> (# State# RealWorld, Bool# #)
- bignat_mul_word :: MutableWordArray# RealWorld -> WordArray# -> Word# -> State# RealWorld -> State# RealWorld
- bignat_mul :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld
- bignat_sub :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> (# State# RealWorld, Bool# #)
- bignat_popcount :: WordArray# -> Word#
- bignat_shiftl :: MutableWordArray# s -> WordArray# -> Word# -> State# s -> State# s
- bignat_shiftr :: MutableWordArray# s -> WordArray# -> Word# -> State# s -> State# s
- bignat_shiftr_neg :: MutableWordArray# s -> WordArray# -> Word# -> State# s -> State# s
- bignat_or :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld
- bignat_xor :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld
- bignat_and :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld
- bignat_and_not :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld
- bignat_quotrem :: MutableWordArray# s -> MutableWordArray# s -> WordArray# -> WordArray# -> State# s -> State# s
- bignat_quot :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld
- bignat_rem :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld
- bignat_quotrem_normalized :: MutableWordArray# s -> MutableWordArray# s -> WordArray# -> State# s -> State# s
- bignat_quotrem_word :: MutableWordArray# s -> WordArray# -> Word# -> State# s -> (# State# s, Word# #)
- bignat_quot_word :: MutableWordArray# s -> WordArray# -> Word# -> State# s -> State# s
- bignat_rem_word :: WordArray# -> Word# -> Word#
- bignat_gcd :: MutableWordArray# s -> WordArray# -> WordArray# -> State# s -> State# s
- bignat_gcd_word :: WordArray# -> Word# -> Word#
- bignat_gcd_word_word :: Word# -> Word# -> Word#
- bignat_encode_double :: WordArray# -> Int# -> Double#
- bignat_powmod_word :: WordArray# -> WordArray# -> Word# -> Word#
- bignat_powmod :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld
- bignat_powmod_words :: Word# -> Word# -> Word# -> Word#

# Documentation

count_words_bits :: Word# -> (# Word#, Word# #) Source #

count_words_bits_int :: Word# -> (# Int#, Int# #) Source #

bignat_compare :: WordArray# -> WordArray# -> Int# Source #

bignat_add Source #

Arguments

:: MutableWordArray# s | Result
-> WordArray# |
-> WordArray# |
-> State# s |
-> State# s |

bignat_add_word Source #

Arguments

:: MutableWordArray# RealWorld | Result
-> WordArray# |
-> Word# |
-> State# RealWorld |
-> State# RealWorld |

bignat_sub_word :: MutableWordArray# RealWorld -> WordArray# -> Word# -> State# RealWorld -> (# State# RealWorld, Bool# #) Source #

bignat_mul_word Source #

Arguments

:: MutableWordArray# RealWorld | Result
-> WordArray# |
-> Word# |
-> State# RealWorld |
-> State# RealWorld |

bignat_mul Source #

Arguments

:: MutableWordArray# RealWorld | Result
-> WordArray# |
-> WordArray# |
-> State# RealWorld |
-> State# RealWorld |

bignat_sub :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> (# State# RealWorld, Bool# #) Source #

bignat_popcount :: WordArray# -> Word# Source #

bignat_shiftl :: MutableWordArray# s -> WordArray# -> Word# -> State# s -> State# s Source #

bignat_shiftr :: MutableWordArray# s -> WordArray# -> Word# -> State# s -> State# s Source #

bignat_shiftr_neg :: MutableWordArray# s -> WordArray# -> Word# -> State# s -> State# s Source #

bignat_or Source #

Arguments

:: MutableWordArray# RealWorld | Result
-> WordArray# |
-> WordArray# |
-> State# RealWorld |
-> State# RealWorld |

bignat_xor Source #

Arguments

:: MutableWordArray# RealWorld | Result
-> WordArray# |
-> WordArray# |
-> State# RealWorld |
-> State# RealWorld |

bignat_and Source #

Arguments

:: MutableWordArray# RealWorld | Result
-> WordArray# |
-> WordArray# |
-> State# RealWorld |
-> State# RealWorld |

bignat_and_not Source #

Arguments

:: MutableWordArray# RealWorld | Result
-> WordArray# |
-> WordArray# |
-> State# RealWorld |
-> State# RealWorld |

bignat_quotrem :: MutableWordArray# s -> MutableWordArray# s -> WordArray# -> WordArray# -> State# s -> State# s Source #

bignat_quot :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld Source #

bignat_rem :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld Source #

bignat_quotrem_normalized :: MutableWordArray# s -> MutableWordArray# s -> WordArray# -> State# s -> State# s Source #

Perform quotRem on normalized inputs: * highest bit of B is set * A is trimmed * A >= B * B > 1

bignat_quotrem_word Source #

Arguments

:: MutableWordArray# s | Quotient
-> WordArray# |
-> Word# |
-> State# s |
-> (# State# s, Word# #) |

bignat_quot_word Source #

Arguments

:: MutableWordArray# s | Quotient
-> WordArray# |
-> Word# |
-> State# s |
-> State# s |

bignat_rem_word :: WordArray# -> Word# -> Word# Source #

bignat_gcd :: MutableWordArray# s -> WordArray# -> WordArray# -> State# s -> State# s Source #

bignat_gcd_word :: WordArray# -> Word# -> Word# Source #

bignat_gcd_word_word :: Word# -> Word# -> Word# Source #

This operation doesn't really belongs here, but GMP's one is much faster than this simple implementation (basic Euclid algorithm).

Ideally we should make an implementation as fast as GMP's one and put it into GHC.Num.Primitives.

bignat_encode_double :: WordArray# -> Int# -> Double# Source #

bignat_powmod_word :: WordArray# -> WordArray# -> Word# -> Word# Source #

bignat_powmod :: MutableWordArray# RealWorld -> WordArray# -> WordArray# -> WordArray# -> State# RealWorld -> State# RealWorld Source #

bignat_powmod_words :: Word# -> Word# -> Word# -> Word# Source #