speed of mpz_odd_p and lazy allocation

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Mon Aug 13 17:10:19 CEST 2012


Ciao,

Il 12 Agosto 2012 10:07 pm, Niels ha scritto:
> Why do you want to do that change now? If you'd prefer to have GMP
> never dereference mp_d when mp_size == 0, then I think we ought to
> discuss that.

There are places in the code where mp_d[0] is written disregard of
previous value of size and alloc... (E.g. try $ grep -C2 "PTR *(.)\[0\]
*=" mpz/*.c )
I agree: a discussion is needed if we want to change that behaviour.

> I also have some related ideas, in particular to use _mp_alloc = 0
> to mean that storage was allocated by the application. Such an mpz_t
> should be used only as input to gmp functions, never as output. One
> use would be for compile time constant bignums.

Do you mean a sort of realloc-on-write? To protect read-only values?

Regards,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list