[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 1fd91fbf 10/22: Rename high- and low-word mac
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 1fd91fbf 10/22: Rename high- and low-word macros |
Date: |
Fri, 20 May 2022 22:43:42 -0400 (EDT) |
branch: master
commit 1fd91fbf4d7d97784d19818a3e45a6dbef94878c
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Rename high- and low-word macros
---
fdlibm_expm1.c.txt | 30 +++++++++++++++---------------
fdlibm_log1p.c.txt | 26 +++++++++++++-------------
2 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/fdlibm_expm1.c.txt b/fdlibm_expm1.c.txt
index f3bee8b2..bc00d625 100644
--- a/fdlibm_expm1.c.txt
+++ b/fdlibm_expm1.c.txt
@@ -20,15 +20,15 @@
#endif // big endian
#if defined __LITTLE_ENDIAN
-#define __HI(x) *(1+(int*)&x)
-#define __LO(x) *(int*)&x
-#define __HIp(x) *(1+(int*)x)
-#define __LOp(x) *(int*)x
+#define FDLIBM_HI(x) *(1+(int*)&x)
+#define FDLIBM_LO(x) *(int*)&x
+#define FDLIBM_HIp(x) *(1+(int*)x)
+#define FDLIBM_LOp(x) *(int*)x
#else // !defined __LITTLE_ENDIAN
-#define __HI(x) *(int*)&x
-#define __LO(x) *(1+(int*)&x)
-#define __HIp(x) *(int*)x
-#define __LOp(x) *(1+(int*)x)
+#define FDLIBM_HI(x) *(int*)&x
+#define FDLIBM_LO(x) *(1+(int*)&x)
+#define FDLIBM_HIp(x) *(int*)x
+#define FDLIBM_LOp(x) *(1+(int*)x)
#endif // !defined __LITTLE_ENDIAN
#if defined __STDC__
@@ -220,7 +220,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
int k,xsb;
unsigned hx;
- hx = __HI(x); /* high word of x */
+ hx = FDLIBM_HI(x); /* high word of x */
xsb = hx&0x80000000; /* sign bit of x */
if(xsb==0) y=x; else y= -x; /* y = |x| */
hx &= 0x7fffffff; /* high word of |x| */
@@ -229,7 +229,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */
if(hx >= 0x40862E42) { /* if |x|>=709.78... */
if(hx>=0x7ff00000) {
- if(((hx&0xfffff)|__LO(x))!=0)
+ if(((hx&0xfffff)|FDLIBM_LO(x))!=0)
return x+x; /* NaN */
else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
}
@@ -279,19 +279,19 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D
*/
else return one+2.0*(x-e);
if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */
y = one-(e-x);
- __HI(y) += (k<<20); /* add k to y's exponent */
+ FDLIBM_HI(y) += (k<<20); /* add k to y's exponent */
return y-one;
}
t = one;
if(k<20) {
- __HI(t) = 0x3ff00000 - (0x200000>>k); /* t=1-2^-k */
+ FDLIBM_HI(t) = 0x3ff00000 - (0x200000>>k); /* t=1-2^-k */
y = t-(e-x);
- __HI(y) += (k<<20); /* add k to y's exponent */
+ FDLIBM_HI(y) += (k<<20); /* add k to y's exponent */
} else {
- __HI(t) = ((0x3ff-k)<<20); /* 2^-k */
+ FDLIBM_HI(t) = ((0x3ff-k)<<20); /* 2^-k */
y = x-(e+t);
y += one;
- __HI(y) += (k<<20); /* add k to y's exponent */
+ FDLIBM_HI(y) += (k<<20); /* add k to y's exponent */
}
}
return y;
diff --git a/fdlibm_log1p.c.txt b/fdlibm_log1p.c.txt
index 36435295..76b62a1f 100644
--- a/fdlibm_log1p.c.txt
+++ b/fdlibm_log1p.c.txt
@@ -20,15 +20,15 @@
#endif // big endian
#if defined __LITTLE_ENDIAN
-#define __HI(x) *(1+(int*)&x)
-#define __LO(x) *(int*)&x
-#define __HIp(x) *(1+(int*)x)
-#define __LOp(x) *(int*)x
+#define FDLIBM_HI(x) *(1+(int*)&x)
+#define FDLIBM_LO(x) *(int*)&x
+#define FDLIBM_HIp(x) *(1+(int*)x)
+#define FDLIBM_LOp(x) *(int*)x
#else // !defined __LITTLE_ENDIAN
-#define __HI(x) *(int*)&x
-#define __LO(x) *(1+(int*)&x)
-#define __HIp(x) *(int*)x
-#define __LOp(x) *(1+(int*)x)
+#define FDLIBM_HI(x) *(int*)&x
+#define FDLIBM_LO(x) *(1+(int*)&x)
+#define FDLIBM_HIp(x) *(int*)x
+#define FDLIBM_LOp(x) *(1+(int*)x)
#endif // !defined __LITTLE_ENDIAN
#if defined __STDC__
@@ -189,7 +189,7 @@ static double zero = 0.0;
double hfsq,f,c,s,z,R,u;
int k,hx,hu,ax;
- hx = __HI(x); /* high word of x */
+ hx = FDLIBM_HI(x); /* high word of x */
ax = hx&0x7fffffff;
k = 1;
@@ -213,22 +213,22 @@ static double zero = 0.0;
if(k!=0) {
if(hx<0x43400000) {
u = 1.0+x;
- hu = __HI(u); /* high word of u */
+ hu = FDLIBM_HI(u); /* high word of u */
k = (hu>>20)-1023;
c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */
c /= u;
} else {
u = x;
- hu = __HI(u); /* high word of u */
+ hu = FDLIBM_HI(u); /* high word of u */
k = (hu>>20)-1023;
c = 0;
}
hu &= 0x000fffff;
if(hu<0x6a09e) {
- __HI(u) = hu|0x3ff00000; /* normalize u */
+ FDLIBM_HI(u) = hu|0x3ff00000; /* normalize u */
} else {
k += 1;
- __HI(u) = hu|0x3fe00000; /* normalize u/2 */
+ FDLIBM_HI(u) = hu|0x3fe00000; /* normalize u/2 */
hu = (0x00100000-hu)>>2;
}
f = u-1.0;
- [lmi-commits] [lmi] master updated (c4515973 -> 6c12b4ea), Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master c4e7bd93 01/22: Import expm1() and log1p() from fdlibm, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master e9f2f432 04/22: Canonicalize #include directives, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master 5cc39664 03/22: Move a closing brace, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master 1fd91fbf 10/22: Rename high- and low-word macros,
Greg Chicares <=
- [lmi-commits] [lmi] master fa7bbb53 05/22: Prefer lmi style, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master 6b073770 08/22: Expunge unreferenced fdlibm versioning, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master cadb36d4 14/22: Don't include any fdlibm header, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master 5b1ef5bb 15/22: Add prototypes, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master dd3abb11 18/22: Demonstrate a defect, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master af8d3ac0 21/22: Rationalize indentation of preprocessor directives, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master 324e171e 02/22: Rectify whitespace, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master 15b1aa35 11/22: Add license and copyright boilerplate, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master 4ec9da1f 12/22: Rename fdlibm sources, Greg Chicares, 2022/05/20
- [lmi-commits] [lmi] master e8a859a3 06/22: Rename prototyping macro, Greg Chicares, 2022/05/20