mpq_cmp_z
Marco Bodrato
bodrato at mail.dm.unipi.it
Fri Aug 21 20:36:22 UTC 2015
Ciao,
Sorry Vincent, you suggested a simple function and received back a
technical discussion about casting in C...
On Fri, August 21, 2015 8:56 am, Torbjörn Granlund wrote:
> not, I've forgotten this level of detail of the C standard. I am not
> too enthusiastic about passing the wrong type, but if we add casts both
> when going to &mpq and when going back to &mpz, I cannot see how that
> could break with a conforming compiler.
Maybe changing the prototype of mpq_cmp_maybe_z to
int mpq_cmp_maybe_z (mpq_srcptr op1, const void *op2, int op2_is_mpz)
so that we can pass to it either an mpq_srcptr or an mpz_srcptr,
then replace occurrences of NUM(op2) with ((mpz_srcptr) op2), and
occurrences of DEN(op2) with DEN((mpq_srcptr) op2)...
Regards,
m
--
http://bodrato.it/papers/
More information about the gmp-devel
mailing list