This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Make __mpexp_twomm1 an array of doubles


Hi,

__mpexp_twomm1 is currently written as an array of `number` which has
to be represented differently in code for big and little-endian
machines.  This is completely unnecessary since we never use the
integer halves and only need the double variant.  Attached patch gets
rid of this cruft and replaces it with a simple array of doubles.
Verified on x86_64 that this does not cause any regressions.  OK to
commit?

Siddhesh

	* sysdeps/ieee754/dbl-64/mpexp.c (__mpexp): Adjust for change
	in type of __mpexp_twomm1.
	* sysdeps/ieee754/dbl-64/mpexp.h (__mpexp_twomm1): Convert to
	an array of doubles.

diff --git a/sysdeps/ieee754/dbl-64/mpexp.c b/sysdeps/ieee754/dbl-64/mpexp.c
index c404820..44bbcf1 100644
--- a/sysdeps/ieee754/dbl-64/mpexp.c
+++ b/sysdeps/ieee754/dbl-64/mpexp.c
@@ -63,7 +63,7 @@ __mpexp(mp_no *x, mp_no *y, int p) {
   mp_no mps,mpak,mpt1,mpt2;
 
   /* Choose m,n and compute a=2**(-m) */
-  n = np[p];    m1 = m1p[p];    a = __mpexp_twomm1[p].d;
+  n = np[p];    m1 = m1p[p];    a = __mpexp_twomm1[p];
   for (i=0; i<EX; i++)  a *= RADIXI;
   for (   ; i>EX; i--)  a *= RADIX;
   b = X[1]*RADIXI;   m2 = 24*EX;
diff --git a/sysdeps/ieee754/dbl-64/mpexp.h b/sysdeps/ieee754/dbl-64/mpexp.h
index 2b26386..b604b97 100644
--- a/sysdeps/ieee754/dbl-64/mpexp.h
+++ b/sysdeps/ieee754/dbl-64/mpexp.h
@@ -27,88 +27,21 @@
 #ifndef MPEXP_H
 #define MPEXP_H
 
-extern const number __mpexp_twomm1[33] attribute_hidden;
+extern const double __mpexp_twomm1[] attribute_hidden;
 
 #ifndef AVOID_MPEXP_H
-#ifdef BIG_ENDI
-  const number
-	__mpexp_twomm1[33] = {                     /* 2**-m1 */
-/**/                  {{0x3ff00000, 0x00000000} }, /* 1      */
-/**/                  {{0x3ff00000, 0x00000000} }, /* 1      */
-/**/                  {{0x3ff00000, 0x00000000} }, /* 1      */
-/**/                  {{0x3ff00000, 0x00000000} }, /* 1      */
-/**/                  {{0x3ee00000, 0x00000000} }, /* 2**-17 */
-/**/                  {{0x3e800000, 0x00000000} }, /* 2**-23 */
-/**/                  {{0x3e800000, 0x00000000} }, /* 2**-23 */
-/**/                  {{0x3e300000, 0x00000000} }, /* 2**-28 */
-/**/                  {{0x3e400000, 0x00000000} }, /* 2**-27 */
-/**/                  {{0x3d900000, 0x00000000} }, /* 2**-38 */
-/**/                  {{0x3d500000, 0x00000000} }, /* 2**-42 */
-/**/                  {{0x3d800000, 0x00000000} }, /* 2**-39 */
-/**/                  {{0x3d400000, 0x00000000} }, /* 2**-43 */
-/**/                  {{0x3d000000, 0x00000000} }, /* 2**-47 */
-/**/                  {{0x3d400000, 0x00000000} }, /* 2**-43 */
-/**/                  {{0x3d000000, 0x00000000} }, /* 2**-47 */
-/**/                  {{0x3cd00000, 0x00000000} }, /* 2**-50 */
-/**/                  {{0x3c900000, 0x00000000} }, /* 2**-54 */
-/**/                  {{0x3c600000, 0x00000000} }, /* 2**-57 */
-/**/                  {{0x3c300000, 0x00000000} }, /* 2**-60 */
-/**/                  {{0x3bf00000, 0x00000000} }, /* 2**-64 */
-/**/                  {{0x3bc00000, 0x00000000} }, /* 2**-67 */
-/**/                  {{0x3b800000, 0x00000000} }, /* 2**-71 */
-/**/                  {{0x3b500000, 0x00000000} }, /* 2**-74 */
-/**/                  {{0x3bb00000, 0x00000000} }, /* 2**-68 */
-/**/                  {{0x3b800000, 0x00000000} }, /* 2**-71 */
-/**/                  {{0x3b500000, 0x00000000} }, /* 2**-74 */
-/**/                  {{0x3b200000, 0x00000000} }, /* 2**-77 */
-/**/                  {{0x3b900000, 0x00000000} }, /* 2**-70 */
-/**/                  {{0x3b600000, 0x00000000} }, /* 2**-73 */
-/**/                  {{0x3b300000, 0x00000000} }, /* 2**-76 */
-/**/                  {{0x3b100000, 0x00000000} }, /* 2**-78 */
-/**/                  {{0x3ae00000, 0x00000000} }, /* 2**-81 */
+const double __mpexp_twomm1[] =
+  {
+    0x1.0p0, 0x1.0p0, 0x1.0p0, 0x1.0p0,
+    0x1.0p-17, 0x1.0p-23, 0x1.0p-23, 0x1.0p-28,
+    0x1.0p-27, 0x1.0p-38, 0x1.0p-42, 0x1.0p-39,
+    0x1.0p-43, 0x1.0p-47, 0x1.0p-43, 0x1.0p-47,
+    0x1.0p-50, 0x1.0p-54, 0x1.0p-57, 0x1.0p-60,
+    0x1.0p-64, 0x1.0p-67, 0x1.0p-71, 0x1.0p-74,
+    0x1.0p-68, 0x1.0p-71, 0x1.0p-74, 0x1.0p-77,
+    0x1.0p-70, 0x1.0p-73, 0x1.0p-76, 0x1.0p-78,
+    0x1.0p-81
   };
-
-#else
-#ifdef LITTLE_ENDI
-  const number
-	__mpexp_twomm1[33] = {                     /* 2**-m1 */
-/**/                  {{0x00000000, 0x3ff00000} }, /* 1      */
-/**/                  {{0x00000000, 0x3ff00000} }, /* 1      */
-/**/                  {{0x00000000, 0x3ff00000} }, /* 1      */
-/**/                  {{0x00000000, 0x3ff00000} }, /* 1      */
-/**/                  {{0x00000000, 0x3ee00000} }, /* 2**-17 */
-/**/                  {{0x00000000, 0x3e800000} }, /* 2**-23 */
-/**/                  {{0x00000000, 0x3e800000} }, /* 2**-23 */
-/**/                  {{0x00000000, 0x3e300000} }, /* 2**-28 */
-/**/                  {{0x00000000, 0x3e400000} }, /* 2**-27 */
-/**/                  {{0x00000000, 0x3d900000} }, /* 2**-38 */
-/**/                  {{0x00000000, 0x3d500000} }, /* 2**-42 */
-/**/                  {{0x00000000, 0x3d800000} }, /* 2**-39 */
-/**/                  {{0x00000000, 0x3d400000} }, /* 2**-43 */
-/**/                  {{0x00000000, 0x3d000000} }, /* 2**-47 */
-/**/                  {{0x00000000, 0x3d400000} }, /* 2**-43 */
-/**/                  {{0x00000000, 0x3d000000} }, /* 2**-47 */
-/**/                  {{0x00000000, 0x3cd00000} }, /* 2**-50 */
-/**/                  {{0x00000000, 0x3c900000} }, /* 2**-54 */
-/**/                  {{0x00000000, 0x3c600000} }, /* 2**-57 */
-/**/                  {{0x00000000, 0x3c300000} }, /* 2**-60 */
-/**/                  {{0x00000000, 0x3bf00000} }, /* 2**-64 */
-/**/                  {{0x00000000, 0x3bc00000} }, /* 2**-67 */
-/**/                  {{0x00000000, 0x3b800000} }, /* 2**-71 */
-/**/                  {{0x00000000, 0x3b500000} }, /* 2**-74 */
-/**/                  {{0x00000000, 0x3bb00000} }, /* 2**-68 */
-/**/                  {{0x00000000, 0x3b800000} }, /* 2**-71 */
-/**/                  {{0x00000000, 0x3b500000} }, /* 2**-74 */
-/**/                  {{0x00000000, 0x3b200000} }, /* 2**-77 */
-/**/                  {{0x00000000, 0x3b900000} }, /* 2**-70 */
-/**/                  {{0x00000000, 0x3b600000} }, /* 2**-73 */
-/**/                  {{0x00000000, 0x3b300000} }, /* 2**-76 */
-/**/                  {{0x00000000, 0x3b100000} }, /* 2**-78 */
-/**/                  {{0x00000000, 0x3ae00000} }, /* 2**-81 */
-  };
-
-#endif
-#endif
 #endif
 
 #define  RADIX     0x1.0p24		/* 2^24 */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]