Unlifted array of Word
Moduleghc-bignum-1.3Haskell2010
GHC.Num.WordArray
- 4 types
- 37 values
- Packageghc-bignum-1.3
- Exports41
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceWordArray.hs
Constructors
Constructors
Convert limb count into byte count
Convert byte count into limb count
withNewWordArray# :: Int#Size in Word
-> (MutableWordArray# RealWorld -> State# RealWorld -> State# RealWorld)-> WordArray#
Create a new WordArray# of the given size (*in Word#*) and apply the action to it before returning it frozen
withNewWordArray2# :: Int#Size in Word
-> Int#Ditto
-> (MutableWordArray# RealWorld -> MutableWordArray# RealWorld -> State# RealWorld -> State# RealWorld)-> (# WordArray#, WordArray# #)
Create two new WordArray# of the given sizes (*in Word#*) and apply the action to them before returning them frozen
Create a new WordArray#
withNewWordArrayTrimmed# :: Int#Size in Word
-> (MutableWordArray# RealWorld -> State# RealWorld -> State# RealWorld)-> WordArray#
Create a new WordArray# of the given size (*in Word#*), apply the action to it, trim its most significant zeroes, then return it frozen
withNewWordArray2Trimmed# :: Int#Size in Word
-> Int#Ditto
-> (MutableWordArray# RealWorld -> MutableWordArray# RealWorld -> State# RealWorld -> State# RealWorld)-> (# WordArray#, WordArray# #)
Create two new WordArray# of the given sizes (*in Word#*), apply the action to them, trim their most significant zeroes, then return them frozen
withNewWordArrayTrimmedMaybe# :: Int#Size in Word
-> (MutableWordArray# RealWorld -> State# RealWorld -> (# State# RealWorld, Bool# #))-> (# (# #) | WordArray# #)
Create a new WordArray# of the given size (*in Word#*), apply the action to it. If the action returns true#, trim its most significant zeroes, then return it frozen. Otherwise, return ().
Create a WordArray# from two Word#
`wordArrayFromWord2# h l where h is the most significant word l is the least significant word
Create a WordArray# from one Word#
Word array size
Equality test for WordArray#
Get size in Words
Get the last Word (must be non empty!)
Copy Words from a WordArray
Don't do anything if the number of words to copy is <= 0
Shrink last words of a WordArray
Set size
Copy the WordArray into the MWA and shrink the size of MWA to the one of the WordArray
Trim ending zeroes
Count leading zero Words
Count leading zero Words starting at given position
Count leading zero Words starting at given position
Compare the most signiciant limbs of a and b. The comparison stops (i.e. returns EQ) when there isn't enough lims in a or b to perform another comparison.
Compute MutableWordArray <- WordArray + Word
The MutableWordArray may not be initialized and will be erased anyway.
Input: Size(MutableWordArray) = Size(WordArray) + 1 Output: Size(MutableWordArray) = Size(WordArray) [+ 1]
Write the most-significant Word: * if it is 0: shrink the array of 1 Word * otherwise: write it
Compute the index of the most-significant Word and write it.
MutableWordArray <- zipWith op wa1 wa2
Required output: Size(MutableWordArray) = min Size(wa1) Size(wa2)
Write an element of the MutableWordArray
Fill some part of a MutableWordArray with the given Word#
Add Word# inplace (a the specified offset) in the mwa with carry propagation.
Sub Word# inplace (at the specified offset) in the mwa with carry propagation.
Return False# on underflow
Trim a of k less significant limbs and then compare the result with b
"mwa" doesn't need to be trimmed
Sub array inplace (at the specified offset) in the mwa with carry propagation.
We don't trim the resulting array!
Return False# on underflow.
Add array inplace (a the specified offset) in the mwa with carry propagation.
Upper bound of the result mutable aray is not checked against overflow.
Sub array inplace (at the specified offset) in the mwa with carry propagation.
We don't trim the resulting array!
Return False# on underflow.
Sub an array inplace and then trim zeroes
Don't check overflow. The caller must ensure that a>=b
Read an indexed Word in the MutableWordArray. If the index is out-of-bound, return zero.