Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't require LIM to determine loop end in __sqr
  • Loading branch information
Siddhesh Poyarekar committed Feb 15, 2013
1 parent 4709fe7 commit 22af19f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
@@ -1,5 +1,8 @@
2013-02-16 Siddhesh Poyarekar <siddhesh@redhat.com>

* sysdeps/ieee754/dbl-64/mpa.c (__sqr): Avoid using LIM in
loop termination condition.

* sysdeps/ieee754/dbl-64/mpa.c (__mul): Use intermediate
variable to calculate EZ.
(__sqr): Likewise.
Expand Down
14 changes: 4 additions & 10 deletions sysdeps/ieee754/dbl-64/mpa.c
Expand Up @@ -747,12 +747,9 @@ __sqr (const mp_no *x, mp_no *y, int p)
long lim = k / 2;

if (k % 2 == 0)
{
yk += X[lim] * X[lim];
lim--;
}
yk += X[lim] * X[lim];

for (i = k - p, j = p; i <= lim; i++, j--)
for (i = k - p, j = p; i < j; i++, j--)
yk2 += X[i] * X[j];

yk += 2.0 * yk2;
Expand All @@ -770,12 +767,9 @@ __sqr (const mp_no *x, mp_no *y, int p)
long lim = k / 2;

if (k % 2 == 0)
{
yk += X[lim] * X[lim];
lim--;
}
yk += X[lim] * X[lim];

for (i = 1, j = k - 1; i <= lim; i++, j--)
for (i = 1, j = k - 1; i < j; i++, j--)
yk2 += X[i] * X[j];

yk += 2.0 * yk2;
Expand Down

0 comments on commit 22af19f

Please sign in to comment.