[MLton] IntInf implementation questions

Henry Cejtin henry.cejtin@sbcglobal.net
Mon, 06 Feb 2006 16:17:33 -0600


As  to  why fill() in IntInf.c requires at least 2 limbs, my guess looking at
my old code is that it was (is?) to make sure that you  can  always  fit  any
32-bit  int in it.  I remember one had to be a bit cautious because of things
that were small but whose negation were not.

Sadly, I don't really remember what the reason for the restriction was.

Re quot and rem, I remember trying to use the mpn stuff (instead of  the  mpz
things)   when  ever  possible  because  they  didn't  do  as  many  internal
allocations.  If  you  look  at  atleast  the  old  (GMP  2.0.2)  source  for
mpz_tdiv_[qr],  they  do pretty much the same as IntInf_quot/rem do, and they
have all kinds of conditions under which they allocate.  You have to be  sure
that  these  routines  do  NOT  allocate, or else you will end up with things
pointing in the malloc heap instead of the MLton one.