301 {
302 if (mpz_cmp_si(n,2)>=0)
303 {
304 mpz_t r;
305 mpz_init(r);
306 mpz_fdiv_r_ui(r,n,2);
307
310
311 mpz_t m;
312 mpz_init(m);
313
314 if (mpz_cmp_si(r,0) == 0)
315 {
316 mpz_cdiv_q_ui(m,n,2);
317
320 }
321 else
322 {
323 mpz_sub_ui(m,n,1);
324
327 }
328 mpz_clear(r);
329 mpz_clear(m);
330 }
331 else if (mpz_cmp_si(n,1)==0)
333 else if (mpz_cmp_si(n,0)==0)
335 else if (mpz_cmp_si(n,0)<0)
336 throw 20;
337 }
void init(ElementType &result) const
void mult(ElementType &result, const ElementType &a, const ElementType &b) const
void power_mpz(ElementType &result, const ElementType &a, mpz_srcptr n) const
VALGRIND_MAKE_MEM_DEFINED & result(result)