This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Additions to the gh_ interface.


> I asked Aubrey why he wasn't using GMP; he said he found GMP's number
> allocation rules too clumsy.

Well, don't use the mpz interfaces of gpm.  Instead, use the lower-level
mpn interfaces.  The mpz functions handle signed-magnitude integers
with a simple malloc-based memory management.  The mpn functions handle
raw unsigned "word" ("limb") arrays, with no memory management.  That
way you can use the clever algorithms and assembly inner loops, without
using the less clever mpz representation and memory management.

If you use mpn, you hava the issue of how to represent signs.  I chose
to use 2's complement, for various reasons.  If you want to see how I
did it, code is available in the gnu.math Java package, distributed
with Kawa.  Of course the details for Guile would be quite different,
but the basic approach should work just as well.

	--Per Bothner
Cygnus Solutions     bothner@cygnus.com     http://www.cygnus.com/~bothner