Changes between Version 17 and Version 18 of ReplacingGMPNotes


Ignore:
Timestamp:
Aug 4, 2006 3:06:38 PM (8 years ago)
Author:
ptanski
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ReplacingGMPNotes

    v17 v18  
    4949        where the Int# counts the number of [http://swox.com/gmp/manual/Nomenclature-and-Types.html#Nomenclature-and-Types limbs] (a GMP term referring to parts of a multi-precision number that fit into a 32 or 64 bit word, depending on the machine) and the ByteArr# is the actual array in RTS-GC memory holding the limbs.  The sign of the Int# is used to indicate the sign of the number represented by the ByteArr#.   
    5050 
    51         This current implementation of Integer means that all large Integers (the J# Int# ByteArr#) are at least the size of an Int# plus a !ByteArr, even if there is only one limb (which would fit into an Int, as Int is also the representation of a machine word in current implementations).  The suggestion discussed by John Meacham, [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010664.html Lennart Augustsson], [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010677.html Simon Marlow] and [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010687.html Bulat Ziganshin] was to change the representation of Integer so the Int# could be either a pointer to the Bignum library array of limbs or, if the number of significant digits could fit into say, 31 bits, to use the extra bit as an indicator of that fact and hold the entire value in the Int#, thereby saving the memory from the ByteArr# and increasing the speed with an unboxed Int#.   
     51        This current implementation of Integer means that there are two separate constructors for small and large Integers (S# Int# and J# Int# ByteArr#).  The suggestion discussed by [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010670.html John Meacham], [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010664.html Lennart Augustsson], [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010677.html Simon Marlow] and [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010687.html Bulat Ziganshin] was to change the representation of Integer so the Int# does the work of S# and J#: the Int# could be either a pointer to the Bignum library array of limbs or, if the number of significant digits could fit into say, 31 bits, to use the extra bit as an indicator of that fact and hold the entire value in the Int#, thereby saving the memory from S# and J#.   
    5252 
    5353        [http://www.haskell.org/pipermail/glasgow-haskell-users/2006-August/010688.html Bulat Ziganshin and John Meacham] noted a few problems with a 30bit Int: