mpz_fac_ui calls shrinking realloc

Torbjorn Granlund tg at gmplib.org
Sat Mar 19 17:18:39 CET 2011


Marc Glisse <marc.glisse at inria.fr> writes:

  this is not a bug, but a surprising behavior:
  mpz_fac_ui often calls realloc to shrink its first parameter.
  
  Is that done on purpose?

I think this should not be done.

mpz/fac_ui.c is on the list of functions to be rewritten.  The current
code is very complex but not very fast.  I, Marco, and Niels had a long
discussiion on what to do, and we have some better code too (mainly by
Marco).  I think we got stuck on a minor decision about prime sieving in
GMP.

In the meantime, I'll fix the allocation behaviour.

-- 
Torbjörn


More information about the gmp-discuss mailing list