Lazy mpz allocation (Was: Re: mpq_cmp_z)

Torbjörn Granlund tg at gmplib.org
Fri Aug 28 16:20:50 UTC 2015


"Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:

  If we change (I'd agree) mpz_init into
  
  void
  mpz_init (mpz_ptr x)
  {
    ALLOC (x) = 0; /* ZERO, any MPZ_REALLOC will allocate */
    PTR (x) = & static_const_limb_shared_by_all_instances;
    SIZ (x) = 0;
  }
  
I suppose we should do this!

  (consequently we will have to change all functions that write a single
  limb, pre-pending an MPZ_REALLOC(var,1) )
  
I suppose this is just in a few places, but it might not to easy to find
them.


-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list