Extending the mpn interface
bodrato at mail.dm.unipi.it
bodrato at mail.dm.unipi.it
Thu Feb 28 12:30:05 CET 2013
Ciao!
A comment about roinit...
Il Sab, 23 Febbraio 2013 5:45 pm, Niels Möller ha scritto:
> +mpz_srcptr
> +mpz_roinit_n (mpz_ptr x, mp_srcptr xp, mp_size_t xs)
> +{
> + ALLOC (x) = 0;
> + SIZ (x) = xs;
> + PTR (x) = xp;
> + return x;
> +}
This function trusts the caller with regards to normalisation. I'm not
sure I like this. I think we should:
- normalize (same code as mpz_limbs_finish) before setting SIZ, or
- add an ASSERT (xs == 0 || xp[ABS (xs)] != 0), and add a "normalize"
function or macro to the documented interface.
Regards,
m
--
http://bodrato.it/papers/
More information about the gmp-devel
mailing list