... | ... | @@ -48,7 +48,7 @@ There are several problems with the current GMP implementation: |
|
|
1. Other Improvements to Integer
|
|
|
|
|
|
>
|
|
|
> Most of the suggestions in this section come from discussions in the glasgow-haskell-users list thread [ returning to Cost of Integer](http://www.haskell.org/pipermail/glasgow-haskell-users/2006-July/010654.html). In particular, [ John Meacham's suggestion](http://www.haskell.org/pipermail/glasgow-haskell-users/2006-July/010660.html) to use a ForeignPtr to data held by the normal GMP system library and store the value in an unboxed Int if the number of significant digits in Integer could fit into the size of an Int. For those who are curious, a guide to GHC primitives is available (in an unformatted version) in ghc/compiler/prelude/primops.txt.pp; here is a link to [ CVS version of primops.txt.pp](http://darcs.haskell.org/ghc/compiler/prelude/primops.txt.pp). (See The GHC Commentary [ Primitives](http://www.cse.unsw.edu.au/~chak/haskell/ghc/comm/rts-libs/primitives.html) for a description of primops.txt.pp.)You might want to search for the text "section "The word size story."", and especially the text "section "Integer\#"". The Haskell definition of Integer is in [ /packages/base/GHC/Num.lhs](http://darcs.haskell.org/packages/base/GHC/Num.lhs).
|
|
|
> Most of the suggestions in this section come from discussions in the glasgow-haskell-users list thread [ returning to Cost of Integer](http://www.haskell.org/pipermail/glasgow-haskell-users/2006-July/010654.html). In particular, [ John Meacham's suggestion](http://www.haskell.org/pipermail/glasgow-haskell-users/2006-July/010660.html) to use a ForeignPtr to data held by the normal GMP system library and store the value in an unboxed Int if the number of significant digits in Integer could fit into the size of an Int. For those who are curious, a guide to GHC primitives is available (in an unformatted version) in ghc/compiler/prelude/primops.txt.pp; here is a link to [ CVS version of primops.txt.pp](http://darcs.haskell.org/ghc/compiler/prelude/primops.txt.pp). (See The GHC Commentary [ Primitives](http://www.cse.unsw.edu.au/~chak/haskell/ghc/comm/rts-libs/primitives.html) for a description of primops.txt.pp; and a highly recommended introduction directly related to GMP is [AddingNewPrimitiveOperations](adding-new-primitive-operations).) In primops.txt.pp, you might want to search for the text "section "The word size story."", and especially the text "section "Integer\#"". The Haskell definition of Integer is in [ /packages/base/GHC/Num.lhs](http://darcs.haskell.org/packages/base/GHC/Num.lhs).
|
|
|
|
|
|
>
|
|
|
> The current GMP implementation of Integer is:
|
... | ... | |