On 10 March 2011 13:07, Steve <sjh_goo...@shic.co.uk> wrote: > I'm wondering, is it safe to re-use the same structure as both the first > and second arguments to mpz_...() functions...
Yes, that is always safe, unless it is explicitly documented otherwise. > > For example, is the idiom: > > void addthenshift(mpz_t &mp,unsigned a,unsigned s) > { > mpz_add_ui(mp,mp,a); > mpz_mul_2exp(mp,mp,s); > } > > always safe? Or, is it necessary to introduce two temporaries? Would > the answer be the same if I replaced "unsigned a" with "const mpz_t &a) > and mpz_add_ui with mpz_add? I've looked in the pdf manual (18 December > 2010) - but can't find an explicit answer. I don't understand the question. An mpz is a completely different structure to an unsigned machine integer... -- You received this message because you are subscribed to the Google Groups "mpir-devel" group. To post to this group, send email to mpir-devel@googlegroups.com. To unsubscribe from this group, send email to mpir-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/mpir-devel?hl=en.