HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulebase-4.22.0.0Haskell2010

GHC.Num.BigNat

  • 2 types
  • 136 values
  • Packagebase-4.22.0.0
  • Exports138
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceBigNat.hs
valuebigNatBit :: Word -> BigNat#
#

Return a BigNat whose bit i is the only one set.

Specialized version of `bigNatShiftL (bigNatFromWord# 1##)`

valuebigNatBit# :: Word# -> BigNat#
#

Return a BigNat whose bit i is the only one set.

Specialized version of `bigNatShiftL (bigNatFromWord# 1##)`

valuebigNatFromAddr#
  1. :: Word#
  2. -> Addr#
  3. -> Bool#
  4. -> State# s
  5. -> (# State# s, BigNat# #)
#

Read a BigNat in base-256 representation from an Addr#.

The size is given in bytes.

The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

Null higher limbs are automatically trimmed.

Read a BigNat in base-256 representation from a ByteArray#.

The size is given in bytes.

The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

Null higher limbs are automatically trimmed.

valuebigNatToAddr :: BigNat# -> Addr# -> Bool# -> IO Word
#

Write a BigNat in base-256 representation and return the number of bytes written.

The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

Use "bigNatSizeInBase 256# i" to compute the exact number of bytes written in advance. In case of i == 0, the function will write and report zero bytes written.

valuebigNatToAddr#
  1. :: BigNat#
  2. -> Addr#
  3. -> Bool#
  4. -> State# s
  5. -> (# State# s, Word# #)
#

Write a BigNat in base-256 representation and return the number of bytes written.

The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

Use "bigNatSizeInBase 256# i" to compute the exact number of bytes written in advance. In case of i == 0, the function will write and report zero bytes written.

valuebigNatToAddrBE# :: BigNat# -> Addr# -> State# s -> (# State# s, Word# #)
#

Write a BigNat in base-256 big-endian representation and return the number of bytes written.

Use "bigNatSizeInBase 256# i" to compute the exact number of bytes written in advance. In case of i == 0, the function will write and report zero bytes written.

valuebigNatToAddrLE# :: BigNat# -> Addr# -> State# s -> (# State# s, Word# #)
#

Write a BigNat in base-256 little-endian representation and return the number of bytes written.

Use "bigNatSizeInBase 256# i" to compute the exact number of bytes written in advance. In case of i == 0, the function will write and report zero bytes written.

Write a BigNat in base-256 representation and return the number of bytes written.

The endianness is selected with the Bool# parameter: most significant byte first (big-endian) if 1# or least significant byte first (little-endian) if 0#.

Use "bigNatSizeInBase 256# i" to compute the exact number of bytes written in advance. In case of i == 0, the function will write and report zero bytes written.

valuegcdInt :: Int -> Int -> Int
#

Greatest common divisor between two Int

Warning: result may become negative if (at least) one argument is minBound

valuegcdInt# :: Int# -> Int# -> Int#
#

Greatest common divisor between two Int#

Warning: result may become negative if (at least) one argument is minBound

datadata BigNat
#

A lifted BigNat

Represented as an array of limbs (Word#) stored in little-endian order (Word# themselves use machine order).

Invariant (canonical representation): higher Word# is non-zero.

As a consequence, zero is represented with a WordArray# whose size is 0.

Constructors

Instances2Eq, Ord
  • Eq BigNatDefined in ghc-internal-9.1401.0 · GHC.Internal.Bignum.BigNat
  • Ord BigNatDefined in ghc-internal-9.1401.0 · GHC.Internal.Bignum.BigNat
typetype BigNat# = WordArray#
#

A BigNat

Represented as an array of limbs (Word#) stored in little-endian order (Word# themselves use machine order).

Invariant (canonical representation): higher Word# is non-zero.

As a consequence, zero is represented with a WordArray# whose size is 0.