mul vs sqr

Paul Zimmermann Paul.Zimmermann at
Tue Apr 20 09:54:49 CEST 2004


I see that mpn_mul() starts by checking for a square:

  if (up == vp && un == vn)
      mpn_sqr_n (prodp, up, un);
      return prodp[2 * un - 1];

This is contrary to the gmp-philosophy "use special functions for special cases"
(for example mpn_mul_2exp).

Why is mpn_sqr_n not exported? Similarly, we might want a "sqr" function for
other classes (mpz, mpf, mpq).


More information about the gmp-devel mailing list