about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2012-12-27 20:43:24 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2012-12-27 20:43:24 +0530
commitb76eb5f076d362cdfbb95f0986285a8661e4082f (patch)
tree86db1db19c800043d2a2061e2fe4f6ea21666527 /sysdeps
parent8ebac7785b6ac0e412075d832af2ede21153148a (diff)
downloadglibc-b76eb5f076d362cdfbb95f0986285a8661e4082f.tar.gz
glibc-b76eb5f076d362cdfbb95f0986285a8661e4082f.tar.xz
glibc-b76eb5f076d362cdfbb95f0986285a8661e4082f.zip
Move mpone out to a global const
Code cleanup.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/ieee754/dbl-64/mpa.c4
-rw-r--r--sysdeps/ieee754/dbl-64/mpa.h2
-rw-r--r--sysdeps/ieee754/dbl-64/mpatan.c9
-rw-r--r--sysdeps/ieee754/dbl-64/mpatan2.c4
-rw-r--r--sysdeps/ieee754/dbl-64/mpexp.c4
-rw-r--r--sysdeps/ieee754/dbl-64/mplog.c12
-rw-r--r--sysdeps/ieee754/dbl-64/mplog.h44
-rw-r--r--sysdeps/x86_64/fpu/multiarch/mpa-avx.c1
-rw-r--r--sysdeps/x86_64/fpu/multiarch/mpa-fma4.c1
9 files changed, 13 insertions, 68 deletions
diff --git a/sysdeps/ieee754/dbl-64/mpa.c b/sysdeps/ieee754/dbl-64/mpa.c
index 7e0ee445c6..b5d25ed2a2 100644
--- a/sysdeps/ieee754/dbl-64/mpa.c
+++ b/sysdeps/ieee754/dbl-64/mpa.c
@@ -51,6 +51,10 @@
 # define SECTION
 #endif
 
+#ifndef NO__CONST
+const mp_no mpone = {1, {1.0, 1.0}};
+#endif
+
 #ifndef NO___ACR
 /* mcr() compares the sizes of the mantissas of two multiple precision  */
 /* numbers. Mantissas are compared regardless of the signs of the       */
diff --git a/sysdeps/ieee754/dbl-64/mpa.h b/sysdeps/ieee754/dbl-64/mpa.h
index 26ae2ac9df..4fdecb60ab 100644
--- a/sysdeps/ieee754/dbl-64/mpa.h
+++ b/sysdeps/ieee754/dbl-64/mpa.h
@@ -54,6 +54,8 @@ typedef struct {/* This structure holds the details of a multi-precision     */
 
 typedef union { int i[2]; double d; } number;
 
+extern const mp_no mpone;
+
 #define  X   x->d
 #define  Y   y->d
 #define  Z   z->d
diff --git a/sysdeps/ieee754/dbl-64/mpatan.c b/sysdeps/ieee754/dbl-64/mpatan.c
index 80637e502b..d897bbbc46 100644
--- a/sysdeps/ieee754/dbl-64/mpatan.c
+++ b/sysdeps/ieee754/dbl-64/mpatan.c
@@ -48,9 +48,6 @@ __mpatan(mp_no *x, mp_no *y, int p) {
   int i,m,n;
   double dx;
   mp_no
-    mpone    = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
-		0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
-		0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}},
     mptwo    = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
 		0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
 		0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}},
@@ -60,7 +57,7 @@ __mpatan(mp_no *x, mp_no *y, int p) {
 
   mp_no mps,mpsm,mpt,mpt1,mpt2,mpt3;
 
-		      /* Choose m and initiate mpone, mptwo & mptwoim1 */
+		      /* Choose m and initiate mptwo & mptwoim1 */
     if      (EX>0) m=7;
     else if (EX<0) m=0;
     else {
@@ -68,8 +65,8 @@ __mpatan(mp_no *x, mp_no *y, int p) {
       for (m=6; m>0; m--)
 	{if (dx>__atan_xm[m].d) break;}
     }
-    mpone.e    = mptwo.e    = mptwoim1.e = 1;
-    mpone.d[0] = mpone.d[1] = mptwo.d[0] = mptwoim1.d[0] = ONE;
+    mptwo.e    = mptwoim1.e = 1;
+    mptwo.d[0] = mptwoim1.d[0] = ONE;
     mptwo.d[1] = TWO;
 
 				 /* Reduce x m times */
diff --git a/sysdeps/ieee754/dbl-64/mpatan2.c b/sysdeps/ieee754/dbl-64/mpatan2.c
index e9c9745265..42cb6a7991 100644
--- a/sysdeps/ieee754/dbl-64/mpatan2.c
+++ b/sysdeps/ieee754/dbl-64/mpatan2.c
@@ -51,14 +51,10 @@ __mpatan2(mp_no *y, mp_no *x, mp_no *z, int p) {
 
   static const double ZERO = 0.0, ONE = 1.0;
 
-  mp_no mpone = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
-		    0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
-		    0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
   mp_no mpt1,mpt2,mpt3;
 
 
   if (X[0] <= ZERO) {
-    mpone.e = 1;                 mpone.d[0] = mpone.d[1] = ONE;
     __dvd(x,y,&mpt1,p);          __mul(&mpt1,&mpt1,&mpt2,p);
     if (mpt1.d[0] != ZERO)       mpt1.d[0] = ONE;
     __add(&mpt2,&mpone,&mpt3,p); __mpsqrt(&mpt3,&mpt2,p);
diff --git a/sysdeps/ieee754/dbl-64/mpexp.c b/sysdeps/ieee754/dbl-64/mpexp.c
index 6b1fcf2555..2762ba91fb 100644
--- a/sysdeps/ieee754/dbl-64/mpexp.c
+++ b/sysdeps/ieee754/dbl-64/mpexp.c
@@ -56,9 +56,6 @@ __mpexp(mp_no *x, mp_no *y, int p) {
 		 { 0, 0, 0, 0, 0, 0,23,28,33,38,42,47,52,57,62,66, 0, 0},
 		 { 0, 0, 0, 0, 0, 0, 0, 0,27, 0, 0,39,43,47,51,55,59,63},
 		 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,43,47,50,54}};
-  mp_no mpone = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
-		    0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
-		    0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
   mp_no mpk   = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
 		    0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
 		    0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
@@ -84,7 +81,6 @@ __mpexp(mp_no *x, mp_no *y, int p) {
   __mul(x,&mpt1,&mps,p);
 
   /* Evaluate the polynomial. Put result in mpt2 */
-  mpone.e=1;   mpone.d[0]=ONE;   mpone.d[1]=ONE;
   mpk.e = 1;   mpk.d[0] = ONE;   mpk.d[1]=__mpexp_nn[n].d;
   __dvd(&mps,&mpk,&mpt1,p);
   __add(&mpone,&mpt1,&mpak,p);
diff --git a/sysdeps/ieee754/dbl-64/mplog.c b/sysdeps/ieee754/dbl-64/mplog.c
index 8255e2a100..c0606c6339 100644
--- a/sysdeps/ieee754/dbl-64/mplog.c
+++ b/sysdeps/ieee754/dbl-64/mplog.c
@@ -40,21 +40,13 @@
 void __mpexp(mp_no *, mp_no *, int);
 
 void __mplog(mp_no *x, mp_no *y, int p) {
-#include "mplog.h"
   int i,m;
-#if 0
-  int j,k,m1,m2,n;
-  double a,b;
-#endif
   static const int mp[33] = {0,0,0,0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
                              4,4,4,4,4,4,4,4,4,4,4,4,4,4};
-  mp_no mpone = {0,{0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
-                    0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,
-                    0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0}};
   mp_no mpt1,mpt2;
 
-  /* Choose m and initiate mpone */
-  m = mp[p];  mpone.e = 1;  mpone.d[0]=mpone.d[1]=ONE;
+  /* Choose m */
+  m = mp[p];
 
   /* Perform m newton iterations to solve for y: exp(y)-x=0.     */
   /* The iterations formula is:  y(n+1)=y(n)+(x*exp(-y(n))-1).   */
diff --git a/sysdeps/ieee754/dbl-64/mplog.h b/sysdeps/ieee754/dbl-64/mplog.h
deleted file mode 100644
index b967f52423..0000000000
--- a/sysdeps/ieee754/dbl-64/mplog.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * IBM Accurate Mathematical Library
- * Written by International Business Machines Corp.
- * Copyright (C) 2001 Free Software Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/******************************************************************/
-/*                                                                */
-/* MODULE_NAME:mplog.h                                            */
-/*                                                                */
-/* common data and variables prototype and definition             */
-/******************************************************************/
-
-#ifndef MPLOG_H
-#define MPLOG_H
-
-#ifdef BIG_ENDI
-  static const number
-/**/ one            = {{0x3ff00000, 0x00000000} }; /* 1      */
-
-#else
-#ifdef LITTLE_ENDI
-  static const number
-/**/ one            = {{0x00000000, 0x3ff00000} }; /* 1      */
-
-#endif
-#endif
-
-#define  ONE       one.d
-
-#endif
diff --git a/sysdeps/x86_64/fpu/multiarch/mpa-avx.c b/sysdeps/x86_64/fpu/multiarch/mpa-avx.c
index a92dbedc05..d3f4d7ab2e 100644
--- a/sysdeps/x86_64/fpu/multiarch/mpa-avx.c
+++ b/sysdeps/x86_64/fpu/multiarch/mpa-avx.c
@@ -7,6 +7,7 @@
 #define NO___CPY 1
 #define NO___MP_DBL 1
 #define NO___ACR 1
+#define NO__CONST 1
 #define SECTION __attribute__ ((section (".text.avx")))
 
 #include <sysdeps/ieee754/dbl-64/mpa.c>
diff --git a/sysdeps/x86_64/fpu/multiarch/mpa-fma4.c b/sysdeps/x86_64/fpu/multiarch/mpa-fma4.c
index f8ed8f3464..6abb671b59 100644
--- a/sysdeps/x86_64/fpu/multiarch/mpa-fma4.c
+++ b/sysdeps/x86_64/fpu/multiarch/mpa-fma4.c
@@ -7,6 +7,7 @@
 #define NO___CPY 1
 #define NO___MP_DBL 1
 #define NO___ACR 1
+#define NO__CONST 1
 #define SECTION __attribute__ ((section (".text.fma4")))
 
 #include <sysdeps/ieee754/dbl-64/mpa.c>