Marc Glisse <marc.glisse at inria.fr> writes:
> There would be a significant advantage to mpq if we could have a
> non-allocated 1 for the denominator. But indeed, with the current code
> where only some mpz functions would work, it seems safer to document
> that none work.
We could do that internally, even if we don't advertise it for other gmp
users. Then mpq_init wouldn't do any allocation, right? We could have a
single mpq object representing 0/1 with _mp_alloc == 0 for both parts,
and initialize with struct assignment or memcpy.
We would just ensure that mpz realloc keeps supporting thuis case.
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.