HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-bignum-1.3Haskell2010

GHC.Num.Primitives

  • 1 type
  • 57 values
  • Packageghc-bignum-1.3
  • Exports58
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourcePrimitives.hs

Bool#

4 declarations

Int#

8 declarations
valueminI# :: Int# -> Int# -> Int#
#
valuemaxI# :: Int# -> Int# -> Int#
#
valuesgnI# :: Int# -> Int#
#

Branchless signum

valueabsI# :: Int# -> Int#
#

Branchless abs

valuecmpI# :: Int# -> Int# -> Int#
#

Branchless comparison

valueintEncodeDouble# :: Int# -> Int# -> Double#
#

Encode (# Int# mantissa, Int# exponent #) into a Double#.

(provided by GHC's RTS)

valuepopCntI# :: Int# -> Word#
#

Population count

Word#

19 declarations
valueandNot# :: Word# -> Word# -> Word#
#
valuebitW# :: Int# -> Word#
#
valuemaxW# :: Word# -> Word# -> Word#
#
valueminW# :: Word# -> Word# -> Word#
#
valueshiftRW# :: Word# -> Word# -> Word#
#

Safe right shift for Word#

valueplusWord3# :: Word# -> Word# -> Word# -> (# Word#, Word# #)
#

Add 3 values together

valueplusWord12# :: Word# -> (# Word#, Word# #) -> (# Word#, Word# #)
#

(h,l) <- a + (hb,lb)

valuequotRemWord3#
  1. :: (# Word#, Word# #)
  2. -> Word#
  3. -> (# (# Word#, Word# #), Word# #)
#

2-by-1 large division

Requires: b0 /= 0 a1 >= b0 (not required, but if not q1=0)

valuewordFromAbsInt# :: Int# -> Word#
#

Return the absolute value of the Int# in a Word#

valuewordLog2# :: Word# -> Word#
#

Compute base-2 log of Word#

This is internally implemented as count-leading-zeros machine instruction.

valuewordLogBase# :: Word# -> Word# -> Word#
#

Logarithm for an arbitrary base

valuewordIsPowerOf2# :: Word# -> (# (# #) | Word# #)
#

Indicate if the value is a power of two and which one

valuewordEncodeDouble# :: Word# -> Int# -> Double#
#

Encode (# Word# mantissa, Int# exponent #) into a Double#.

(provided by GHC's RTS)

valuewordReverseBits32# :: Word# -> Word#
#

Reverse bits in the Word32 subwords composing a Word#

Addr import/export

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

Read a Word from addr in base-256 representation.

@n is the number of bytes to read.

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

valuewordFromAddrLE# :: Word# -> Addr# -> State# s -> (# State# s, Word# #)
#

Read a Word from addr in base-256 little-endian representation.

@n is the number of bytes to read.

valuewordFromAddrBE# :: Word# -> Addr# -> State# s -> (# State# s, Word# #)
#

Read a Word from addr in base-256 big-endian representation.

@n is the number of bytes to read.

valuewordToAddr# :: Word# -> Addr# -> Bool# -> State# s -> (# State# s, Word# #)
#

Write a Word to addr in base-256 representation and return the number of bytes written.

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

valuewordToAddrLE# :: Word# -> Addr# -> State# s -> (# State# s, Word# #)
#

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

valuewordToAddrBE# :: Word# -> Addr# -> State# s -> (# State# s, Word# #)
#

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

valuewordWriteAddrLE# :: Word# -> Addr# -> State# s -> State# s
#

Write a full word with little-endian encoding

valuewordWriteAddrBE# :: Word# -> Addr# -> State# s -> State# s
#

Write a full word with little-endian encoding

ByteArray import/export

valuewordFromByteArray# :: Word# -> ByteArray# -> Word# -> Bool# -> Word#
#

Read a Word from ByteArray in base-256 representation.

@n is the number of bytes to read.

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

valuewordFromByteArrayLE# :: Word# -> ByteArray# -> Word# -> Word#
#

Read a Word from ByteArray in base-256 little-endian representation.

@n is the number of bytes to read.

valuewordFromByteArrayBE# :: Word# -> ByteArray# -> Word# -> Word#
#

Read a Word from ByteArray in base-256 big-endian representation.

@n is the number of bytes to read.

valuewordToMutableByteArray#
  1. :: Word#
  2. -> MutableByteArray# s
  3. -> Word#
  4. -> Bool#
  5. -> State# s
  6. -> (# State# s, Word# #)
#

Write a Word to MutableByteArray in base-256 representation and return the number of bytes written.

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

The offset is in bytes.

valuewordToMutableByteArrayLE#
  1. :: Word#
  2. -> MutableByteArray# s
  3. -> Word#
  4. -> State# s
  5. -> (# State# s, Word# #)
#

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

The offset is in bytes.

valuewordToMutableByteArrayBE#
  1. :: Word#
  2. -> MutableByteArray# s
  3. -> Word#
  4. -> State# s
  5. -> (# State# s, Word# #)
#

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

The offset is in bytes.

valuewordWriteMutableByteArrayLE#
  1. :: Word#
  2. -> MutableByteArray# s
  3. -> Word#
  4. -> State# s
  5. -> State# s
#

Write a full word with little-endian encoding

valuewordWriteMutableByteArrayBE#
  1. :: Word#
  2. -> MutableByteArray# s
  3. -> Word#
  4. -> State# s
  5. -> State# s
#

Write a full word with little-endian encoding

Exception

7 declarations
valueraiseDivZero :: a
#

Raise GHC.Exception.Type.divZeroException

IO

4 declarations
valueioWord# :: IO Word -> State# RealWorld -> (# State# RealWorld, Word# #)
#
valueioInt# :: IO Int -> State# RealWorld -> (# State# RealWorld, Int# #)
#
valueioVoid :: IO a -> State# RealWorld -> State# RealWorld
#