Use __sqr instead of __mul wherever possible

This commit is contained in:
Siddhesh Poyarekar 2013-02-14 11:39:14 +05:30
parent d6752ccd69
commit f414520d3c
4 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,11 @@
2013-02-14 Siddhesh Poyarekar <siddhesh@redhat.com> 2013-02-14 Siddhesh Poyarekar <siddhesh@redhat.com>
* sysdeps/ieee754/dbl-64/mpatan.c (__mpatan): Use __sqr
instead of __mul.
* sysdeps/ieee754/dbl-64/mpsqrt.c (__mpsqrt): Likewise.
* sysdeps/ieee754/dbl-64/sincos32.c (ss32): Likewise.
(cc32): Likewise.
* sysdeps/ieee754/dbl-64/mpa.c (__sqr): New function. * sysdeps/ieee754/dbl-64/mpa.c (__sqr): New function.
* sysdeps/ieee754/dbl-64/mpa.h (__sqr): Declare. * sysdeps/ieee754/dbl-64/mpa.h (__sqr): Declare.
* sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): use __sqr instead * sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): use __sqr instead

View File

@ -66,7 +66,7 @@ __mpatan(mp_no *x, mp_no *y, int p) {
mptwoim1.d[0] = ONE; mptwoim1.d[0] = ONE;
/* Reduce x m times */ /* Reduce x m times */
__mul(x,x,&mpsm,p); __sqr(x,&mpsm,p);
if (m==0) __cpy(x,&mps,p); if (m==0) __cpy(x,&mps,p);
else { else {
for (i=0; i<m; i++) { for (i=0; i<m; i++) {

View File

@ -63,7 +63,7 @@ __mpsqrt(mp_no *x, mp_no *y, int p) {
m=__mpsqrt_mp[p]; m=__mpsqrt_mp[p];
for (i=0; i<m; i++) { for (i=0; i<m; i++) {
__mul(&mpu,&mpu,&mpt1,p); __sqr(&mpu,&mpt1,p);
__mul(&mpt1,&mpz,&mpt2,p); __mul(&mpt1,&mpz,&mpt2,p);
__sub(&mp3halfs,&mpt2,&mpt1,p); __sub(&mp3halfs,&mpt2,&mpt1,p);
__mul(&mpu,&mpt1,&mpt2,p); __mul(&mpu,&mpt1,&mpt2,p);

View File

@ -67,7 +67,7 @@ ss32(mp_no *x, mp_no *y, int p) {
#endif #endif
for (i=1;i<=p;i++) mpk.d[i]=0; for (i=1;i<=p;i++) mpk.d[i]=0;
__mul(x,x,&x2,p); __sqr(x,&x2,p);
__cpy(&oofac27,&gor,p); __cpy(&oofac27,&gor,p);
__cpy(&gor,&sum,p); __cpy(&gor,&sum,p);
for (a=27.0;a>1.0;a-=2.0) { for (a=27.0;a>1.0;a-=2.0) {
@ -99,7 +99,7 @@ cc32(mp_no *x, mp_no *y, int p) {
#endif #endif
for (i=1;i<=p;i++) mpk.d[i]=0; for (i=1;i<=p;i++) mpk.d[i]=0;
__mul(x,x,&x2,p); __sqr(x,&x2,p);
mpk.d[1]=27.0; mpk.d[1]=27.0;
__mul(&oofac27,&mpk,&gor,p); __mul(&oofac27,&mpk,&gor,p);
__cpy(&gor,&sum,p); __cpy(&gor,&sum,p);