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] Remove MONE and ONE macros


Hi,

Attached patch removes macros ONE and MONE and uses the constants 1
and -1 directly.  Tested on x86_64.  OK to commit?

Siddhesh

	* sysdeps/ieee754/dbl-64/e_log.c (__ieee754_log): Remove MONE
	and ONE.
	* sysdeps/ieee754/dbl-64/mpa.h: Likewise.
	(__pow_mp): Likewise.
	* sysdeps/ieee754/dbl-64/mpatan.c (__mpatan): Likewise.
	* sysdeps/ieee754/dbl-64/mpatan2.c (__mpatan2): Likewise.
	* sysdeps/ieee754/dbl-64/mptan.c (__mptan): Likewise.
	* sysdeps/ieee754/dbl-64/s_atan.c (atan): Likewise.
	* sysdeps/ieee754/dbl-64/s_tan.c (tan): Likewise.

diff --git a/sysdeps/ieee754/dbl-64/e_log.c b/sysdeps/ieee754/dbl-64/e_log.c
index f8d5a19..f9300f9 100644
--- a/sysdeps/ieee754/dbl-64/e_log.c
+++ b/sysdeps/ieee754/dbl-64/e_log.c
@@ -91,7 +91,7 @@ __ieee754_log (double x)
 
   /* Regular values of x */
 
-  w = x - ONE;
+  w = x - 1;
   if (__builtin_expect (ABS (w) > U03, 1))
     goto case_03;
 
@@ -178,7 +178,7 @@ case_03:
   j = (num.i[HIGH_HALF] & 0x000fffff) >> 4;
 
   /* Compute w=(u-ui*vj)/(ui*vj) */
-  p0 = (ONE + (i - 75) * DEL_U) * (ONE + (j - 180) * DEL_V);
+  p0 = (1 + (i - 75) * DEL_U) * (1 + (j - 180) * DEL_V);
   q = u - p0;
   r0 = Iu[i].d * Iv[j].d;
   w = q * r0;
@@ -206,7 +206,7 @@ case_03:
 
   /* Improve the accuracy of r0 */
   EMULV (p0, r0, sa, sb, t1, t2, t3, t4, t5);
-  t = r0 * ((ONE - sa) - sb);
+  t = r0 * ((1 - sa) - sb);
   EADD (r0, t, ra, rb);
 
   /* Compute w */
diff --git a/sysdeps/ieee754/dbl-64/mpa.h b/sysdeps/ieee754/dbl-64/mpa.h
index 27bc7dc..ee81f5c 100644
--- a/sysdeps/ieee754/dbl-64/mpa.h
+++ b/sysdeps/ieee754/dbl-64/mpa.h
@@ -91,8 +91,6 @@ extern const mp_no mptwo;
 # define  TWO52     0x1.0p52		/* 2^52    */
 #endif
 
-#define  ONE       1.0			/* 1       */
-#define  MONE      -1.0			/* -1      */
 #define  TWO       2.0			/*  2      */
 
 #define  TWO5      TWOPOW (5)		/* 2^5     */
@@ -150,7 +148,7 @@ __pow_mp (int pow, mp_no *y, int p)
       rem += 24;
     }
   /* The sign of any 2^x is always positive.  */
-  Y[0] = ONE;
+  Y[0] = 1;
   Y[1] = 1 << rem;
 
   /* Everything else is 0.  */
diff --git a/sysdeps/ieee754/dbl-64/mpatan.c b/sysdeps/ieee754/dbl-64/mpatan.c
index cc879d8..33c6847 100644
--- a/sysdeps/ieee754/dbl-64/mpatan.c
+++ b/sysdeps/ieee754/dbl-64/mpatan.c
@@ -74,7 +74,7 @@ __mpatan (mp_no *x, mp_no *y, int p)
 	}
     }
   mptwoim1.e = 1;
-  mptwoim1.d[0] = ONE;
+  mptwoim1.d[0] = 1;
 
   /* Reduce x m times.  */
   __sqr (x, &mpsm, p);
diff --git a/sysdeps/ieee754/dbl-64/mpatan2.c b/sysdeps/ieee754/dbl-64/mpatan2.c
index f4aa9db..f66f9eb 100644
--- a/sysdeps/ieee754/dbl-64/mpatan2.c
+++ b/sysdeps/ieee754/dbl-64/mpatan2.c
@@ -51,7 +51,7 @@ __mpatan2 (mp_no *y, mp_no *x, mp_no *z, int p)
       __dvd (x, y, &mpt1, p);
       __mul (&mpt1, &mpt1, &mpt2, p);
       if (mpt1.d[0] != 0)
-	mpt1.d[0] = ONE;
+	mpt1.d[0] = 1;
       __add (&mpt2, &mpone, &mpt3, p);
       __mpsqrt (&mpt3, &mpt2, p);
       __add (&mpt1, &mpt2, &mpt3, p);
diff --git a/sysdeps/ieee754/dbl-64/mptan.c b/sysdeps/ieee754/dbl-64/mptan.c
index 51b5718..281bfca 100644
--- a/sysdeps/ieee754/dbl-64/mptan.c
+++ b/sysdeps/ieee754/dbl-64/mptan.c
@@ -56,7 +56,7 @@ __mptan (double x, mp_no *mpy, int p)
   if (n)
     {
       __dvd (&mpc, &mps, mpy, p);
-      mpy->d[0] *= MONE;
+      mpy->d[0] *= -1;
     }
   /* tan is negative in this area.  */
   else
diff --git a/sysdeps/ieee754/dbl-64/s_atan.c b/sysdeps/ieee754/dbl-64/s_atan.c
index e3c4be7..7b6c83f 100644
--- a/sysdeps/ieee754/dbl-64/s_atan.c
+++ b/sysdeps/ieee754/dbl-64/s_atan.c
@@ -179,9 +179,9 @@ atan (double x)
     {
       if (u < D)
 	{			/* C <= u < D */
-	  w = ONE / u;
+	  w = 1 / u;
 	  EMULV (w, u, t1, t2, t3, t4, t5, t6, t7);
-	  ww = w * ((ONE - t1) - t2);
+	  ww = w * ((1 - t1) - t2);
 	  i = (TWO52 + TWO8 * w) - TWO52;
 	  i -= 16;
 	  z = (w - cij[i][0].d) + ww;
@@ -200,7 +200,7 @@ atan (double x)
 	  if ((y = t1 + (yy - u3)) == t1 + (yy + u3))
 	    return __signArctan (x, y);
 
-	  DIV2 (ONE, 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8, t9,
+	  DIV2 (1 , 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8, t9,
 		t10);
 	  t1 = w - hij[i][0].d;
 	  EADD (t1, ww, z, zz);
@@ -230,7 +230,7 @@ atan (double x)
 	{
 	  if (u < E)
 	    {			/* D <= u < E */
-	      w = ONE / u;
+	      w = 1 / u;
 	      v = w * w;
 	      EMULV (w, u, t1, t2, t3, t4, t5, t6, t7);
 
@@ -241,13 +241,13 @@ atan (double x)
 	      yy = d3.d + v * yy;
 	      yy *= w * v;
 
-	      ww = w * ((ONE - t1) - t2);
+	      ww = w * ((1 - t1) - t2);
 	      ESUB (HPI, w, t3, cor);
 	      yy = ((HPI1 + cor) - ww) - yy;
 	      if ((y = t3 + (yy - U4)) == t3 + (yy + U4))
 		return __signArctan (x, y);
 
-	      DIV2 (ONE, 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8,
+	      DIV2 (1 , 0, u, 0, w, ww, t1, t2, t3, t4, t5, t6, t7, t8,
 		    t9, t10);
 	      MUL2 (w, ww, w, ww, v, vv, t1, t2, t3, t4, t5, t6, t7, t8);
 
diff --git a/sysdeps/ieee754/dbl-64/s_tan.c b/sysdeps/ieee754/dbl-64/s_tan.c
index 91fe2b8..54f863e 100644
--- a/sysdeps/ieee754/dbl-64/s_tan.c
+++ b/sysdeps/ieee754/dbl-64/s_tan.c
@@ -154,7 +154,7 @@ tan (double x)
       i = ((int) (mfftnhf.d + TWO8 * w));
       z = w - xfg[i][0].d;
       z2 = z * z;
-      s = (x < 0.0) ? MONE : ONE;
+      s = (x < 0.0) ? -1 : 1;
       pz = z + z * z2 * (e0.d + z2 * e1.d);
       fi = xfg[i][1].d;
       gi = xfg[i][2].d;
@@ -214,13 +214,13 @@ tan (double x)
 	{
 	  ya = -a;
 	  yya = -da;
-	  sy = MONE;
+	  sy = -1;
 	}
       else
 	{
 	  ya = a;
 	  yya = da;
-	  sy = ONE;
+	  sy = 1;
 	}
 
       /* (IV),(V) The case 0.787 < abs(x) <= 25,    abs(y) <= 1e-7 */
@@ -438,13 +438,13 @@ tan (double x)
 	{
 	  ya = -a;
 	  yya = -da;
-	  sy = MONE;
+	  sy = -1;
 	}
       else
 	{
 	  ya = a;
 	  yya = da;
-	  sy = ONE;
+	  sy = 1;
 	}
 
       /* (+++) The case 25 < abs(x) <= 1e8,    abs(y) <= 1e-7 */
@@ -631,13 +631,13 @@ tan (double x)
     {
       ya = -a;
       yya = -da;
-      sy = MONE;
+      sy = -1;
     }
   else
     {
       ya = a;
       yya = da;
-      sy = ONE;
+      sy = 1;
     }
 
   /* (+++) The case 1e8 < abs(x) < 2**1024,    abs(y) <= 1e-7 */


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