Commit 0d16618c by Tom Tromey

[multiple changes]

Fri May 28 22:20:03 1999  Anthony Green  <green@cygnus.com>
	* java/lang/fdlibm.h: Don't use __uint32_t.  Include mprec.h.
	* java/lang/e_log.c: Don't use __uint32_t.
1999-05-27  Eric Christopher <echristo@cygnus.com>
	* configure: Rebuilt
	* configure.in: Fixed ISO C9X and namespace collision with __uint32_t
	* acconfig.h: Rebuilt
	* include/config.h.in: Rebuilt
	* java/lang/mprec.h, java/lang/e_acos.c, java/lang/e_asin.c,
 	java/lang/e_atan2.c, java/lang/e_exp.c, java/lang/e_fmod.c,
 	e_log.c, java/lang/e_pow.c, java/lang/e_rem_pio2.c,
 	java/lang/e_remainder.c, java/lang/e_sqrt.c, java/lang/fdlibm.h,
 	k_tan.c, java/lang/mprec.h, java/lang/s_atan.c,
 	java/lang/s_ceil.c, java/lang/s_copysign.c, java/lang/s_fabs.c,
 	s_floor.c, java/lang/s_rint.c, java/lang/sf_rint.c: Fixed ISO C9X
 	and namespace collision with __uint32_t

From-SVN: r27729
parent fe574d5d
Fri May 28 22:20:03 1999 Anthony Green <green@cygnus.com>
* java/lang/fdlibm.h: Don't use __uint32_t. Include mprec.h.
* java/lang/e_log.c: Don't use __uint32_t.
1999-05-27 Eric Christopher <echristo@cygnus.com>
* configure: Rebuilt
* configure.in: Fixed ISO C9X and namespace collision with __uint32_t
* acconfig.h: Rebuilt
* include/config.h.in: Rebuilt
* java/lang/mprec.h, java/lang/e_acos.c, java/lang/e_asin.c,
java/lang/e_atan2.c, java/lang/e_exp.c, java/lang/e_fmod.c,
e_log.c, java/lang/e_pow.c, java/lang/e_rem_pio2.c,
java/lang/e_remainder.c, java/lang/e_sqrt.c, java/lang/fdlibm.h,
k_tan.c, java/lang/mprec.h, java/lang/s_atan.c,
java/lang/s_ceil.c, java/lang/s_copysign.c, java/lang/s_fabs.c,
s_floor.c, java/lang/s_rint.c, java/lang/sf_rint.c: Fixed ISO C9X
and namespace collision with __uint32_t
1999-06-23 Tom Tromey <tromey@cygnus.com> 1999-06-23 Tom Tromey <tromey@cygnus.com>
* java/util/zip/InflaterInputStream.java (read): Throw * java/util/zip/InflaterInputStream.java (read): Throw
......
...@@ -28,9 +28,12 @@ ...@@ -28,9 +28,12 @@
/* Define if you have sleep. */ /* Define if you have sleep. */
#undef HAVE_SLEEP #undef HAVE_SLEEP
/* Define if you have __int32_t and __uint32_t. */ /* Define if you have int32_t and uint32_t. */
#undef HAVE_INT32_DEFINED #undef HAVE_INT32_DEFINED
/* Define if you have u_int32_t */
#undef HAVE_BSD_INT32_DEFINED
/* Define if you're running eCos. */ /* Define if you're running eCos. */
#undef ECOS #undef ECOS
......
...@@ -64,8 +64,11 @@ case "$TARGET_ECOS" in ...@@ -64,8 +64,11 @@ case "$TARGET_ECOS" in
;; ;;
esac esac
AC_EGREP_HEADER(__uint32_t, sys/types.h, AC_DEFINE(HAVE_INT32_DEFINED)) AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED))
AC_EGREP_HEADER(__uint32_t, sys/config.h, AC_DEFINE(HAVE_INT32_DEFINED)) AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED))
AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED))
AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED))
dnl These may not be defined in a non-ANS conformant embedded system. dnl These may not be defined in a non-ANS conformant embedded system.
dnl FIXME: Should these case a runtime exception in that case? dnl FIXME: Should these case a runtime exception in that case?
...@@ -466,7 +469,7 @@ AC_SUBST(AM_RUNTESTFLAGS) ...@@ -466,7 +469,7 @@ AC_SUBST(AM_RUNTESTFLAGS)
dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there. dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
dnl On that system, sys/ioctl.h will not include sys/filio.h unless dnl On that system, sys/ioctl.h will not include sys/filio.h unless
dnl BSD_COMP is defined; just including sys/filio.h is simpler. dnl BSD_COMP is defined; just including sys/filio.h is simpler.
AC_CHECK_HEADERS(unistd.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h) AC_CHECK_HEADERS(unistd.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/filio.h sys/stat.h sys/select.h sys/socket.h netinet/in.h arpa/inet.h netdb.h pwd.h sys/config.h inttypes.h stdint.h)
dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h dnl We avoid AC_HEADER_DIRENT since we really only care about dirent.h
dnl for now. If you change this, you also must update natFile.cc. dnl for now. If you change this, you also must update natFile.cc.
AC_CHECK_HEADERS(dirent.h) AC_CHECK_HEADERS(dirent.h)
......
...@@ -40,9 +40,12 @@ ...@@ -40,9 +40,12 @@
/* Define if you have strerror. */ /* Define if you have strerror. */
#undef HAVE_STRERROR #undef HAVE_STRERROR
/* Define if you have __int32_t and __uint32_t. */ /* Define if you have int32_t and uint32_t. */
#undef HAVE_INT32_DEFINED #undef HAVE_INT32_DEFINED
/* Define if you have u_int32_t */
#undef HAVE_BSD_INT32_DEFINED
/* Define if you're running eCos. */ /* Define if you're running eCos. */
#undef ECOS #undef ECOS
...@@ -214,6 +217,9 @@ ...@@ -214,6 +217,9 @@
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H #undef HAVE_FCNTL_H
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the <netdb.h> header file. */ /* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H #undef HAVE_NETDB_H
...@@ -223,6 +229,12 @@ ...@@ -223,6 +229,12 @@
/* Define if you have the <pwd.h> header file. */ /* Define if you have the <pwd.h> header file. */
#undef HAVE_PWD_H #undef HAVE_PWD_H
/* Define if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define if you have the <sys/config.h> header file. */
#undef HAVE_SYS_CONFIG_H
/* Define if you have the <sys/filio.h> header file. */ /* Define if you have the <sys/filio.h> header file. */
#undef HAVE_SYS_FILIO_H #undef HAVE_SYS_FILIO_H
......
...@@ -679,7 +679,7 @@ _DEFUN (_dtoa_r, ...@@ -679,7 +679,7 @@ _DEFUN (_dtoa_r,
{ {
if (!word1 (d) && !(word0 (d) & Bndry_mask) if (!word1 (d) && !(word0 (d) & Bndry_mask)
#ifndef Sudden_Underflow #ifndef Sudden_Underflow
&& word0 (d) & Exp_mask && word0(d) & Exp_mask
#endif #endif
) )
{ {
...@@ -902,5 +902,3 @@ _DEFUN (_dtoa, ...@@ -902,5 +902,3 @@ _DEFUN (_dtoa,
return; return;
} }
...@@ -67,11 +67,11 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ ...@@ -67,11 +67,11 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
#endif #endif
{ {
double z,p,q,r,w,s,c,df; double z,p,q,r,w,s,c,df;
__int32_t hx,ix; int32_t hx,ix;
GET_HIGH_WORD(hx,x); GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff; ix = hx&0x7fffffff;
if(ix>=0x3ff00000) { /* |x| >= 1 */ if(ix>=0x3ff00000) { /* |x| >= 1 */
__uint32_t lx; uint32_t lx;
GET_LOW_WORD(lx,x); GET_LOW_WORD(lx,x);
if(((ix-0x3ff00000)|lx)==0) { /* |x|==1 */ if(((ix-0x3ff00000)|lx)==0) { /* |x|==1 */
if(hx>0) return 0.0; /* acos(1) = 0 */ if(hx>0) return 0.0; /* acos(1) = 0 */
......
...@@ -63,8 +63,8 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ ...@@ -63,8 +63,8 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
#endif #endif
{ {
double z; double z;
__int32_t k,m,hx,hy,ix,iy; int32_t k,m,hx,hy,ix,iy;
__uint32_t lx,ly; uint32_t lx,ly;
EXTRACT_WORDS(hx,lx,x); EXTRACT_WORDS(hx,lx,x);
ix = hx&0x7fffffff; ix = hx&0x7fffffff;
...@@ -117,7 +117,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ ...@@ -117,7 +117,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
switch (m) { switch (m) {
case 0: return z ; /* atan(+,+) */ case 0: return z ; /* atan(+,+) */
case 1: { case 1: {
__uint32_t zh; uint32_t zh;
GET_HIGH_WORD(zh,z); GET_HIGH_WORD(zh,z);
SET_HIGH_WORD(z,zh ^ 0x80000000); SET_HIGH_WORD(z,zh ^ 0x80000000);
} }
......
...@@ -109,8 +109,8 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ ...@@ -109,8 +109,8 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
#endif #endif
{ {
double y,hi,lo,c,t; double y,hi,lo,c,t;
__int32_t k,xsb; int32_t k,xsb;
__uint32_t hx; uint32_t hx;
GET_HIGH_WORD(hx,x); GET_HIGH_WORD(hx,x);
xsb = (hx>>31)&1; /* sign bit of x */ xsb = (hx>>31)&1; /* sign bit of x */
...@@ -119,7 +119,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ ...@@ -119,7 +119,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
/* filter out non-finite argument */ /* filter out non-finite argument */
if(hx >= 0x40862E42) { /* if |x|>=709.78... */ if(hx >= 0x40862E42) { /* if |x|>=709.78... */
if(hx>=0x7ff00000) { if(hx>=0x7ff00000) {
__uint32_t lx; uint32_t lx;
GET_LOW_WORD(lx,x); GET_LOW_WORD(lx,x);
if(((hx&0xfffff)|lx)!=0) if(((hx&0xfffff)|lx)!=0)
return x+x; /* NaN */ return x+x; /* NaN */
...@@ -152,12 +152,12 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ ...@@ -152,12 +152,12 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
if(k==0) return one-((x*c)/(c-2.0)-x); if(k==0) return one-((x*c)/(c-2.0)-x);
else y = one-((lo-(x*c)/(2.0-c))-hi); else y = one-((lo-(x*c)/(2.0-c))-hi);
if(k >= -1021) { if(k >= -1021) {
__uint32_t hy; uint32_t hy;
GET_HIGH_WORD(hy,y); GET_HIGH_WORD(hy,y);
SET_HIGH_WORD(y,hy+(k<<20)); /* add k to y's exponent */ SET_HIGH_WORD(y,hy+(k<<20)); /* add k to y's exponent */
return y; return y;
} else { } else {
__uint32_t hy; uint32_t hy;
GET_HIGH_WORD(hy,y); GET_HIGH_WORD(hy,y);
SET_HIGH_WORD(y,hy+((k+1000)<<20)); /* add k to y's exponent */ SET_HIGH_WORD(y,hy+((k+1000)<<20)); /* add k to y's exponent */
return y*twom1000; return y*twom1000;
......
...@@ -34,8 +34,8 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; ...@@ -34,8 +34,8 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
double x,y ; double x,y ;
#endif #endif
{ {
__int32_t n,hx,hy,hz,ix,iy,sx,i; int32_t n,hx,hy,hz,ix,iy,sx,i;
__uint32_t lx,ly,lz; uint32_t lx,ly,lz;
EXTRACT_WORDS(hx,lx,x); EXTRACT_WORDS(hx,lx,x);
EXTRACT_WORDS(hy,ly,y); EXTRACT_WORDS(hy,ly,y);
...@@ -50,7 +50,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; ...@@ -50,7 +50,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
if(hx<=hy) { if(hx<=hy) {
if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */ if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
if(lx==ly) if(lx==ly)
return Zero[(__uint32_t)sx>>31]; /* |x|=|y| return x*0*/ return Zero[(uint32_t)sx>>31]; /* |x|=|y| return x*0*/
} }
/* determine ix = ilogb(x) */ /* determine ix = ilogb(x) */
...@@ -104,7 +104,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; ...@@ -104,7 +104,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;} if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;}
else { else {
if((hz|lz)==0) /* return sign(x)*0 */ if((hz|lz)==0) /* return sign(x)*0 */
return Zero[(__uint32_t)sx>>31]; return Zero[(uint32_t)sx>>31];
hx = hz+hz+(lz>>31); lx = lz+lz; hx = hz+hz+(lz>>31); lx = lz+lz;
} }
} }
...@@ -113,7 +113,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; ...@@ -113,7 +113,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
/* convert back to floating value and restore the sign */ /* convert back to floating value and restore the sign */
if((hx|lx)==0) /* return sign(x)*0 */ if((hx|lx)==0) /* return sign(x)*0 */
return Zero[(__uint32_t)sx>>31]; return Zero[(uint32_t)sx>>31];
while(hx<0x00100000) { /* normalize x */ while(hx<0x00100000) { /* normalize x */
hx = hx+hx+(lx>>31); lx = lx+lx; hx = hx+hx+(lx>>31); lx = lx+lx;
iy -= 1; iy -= 1;
...@@ -124,7 +124,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; ...@@ -124,7 +124,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
} else { /* subnormal output */ } else { /* subnormal output */
n = -1022 - iy; n = -1022 - iy;
if(n<=20) { if(n<=20) {
lx = (lx>>n)|((__uint32_t)hx<<(32-n)); lx = (lx>>n)|((uint32_t)hx<<(32-n));
hx >>= n; hx >>= n;
} else if (n<=31) { } else if (n<=31) {
lx = (hx<<(32-n))|(lx>>n); hx = sx; lx = (hx<<(32-n))|(lx>>n); hx = sx;
......
...@@ -96,8 +96,8 @@ static double zero = 0.0; ...@@ -96,8 +96,8 @@ static double zero = 0.0;
#endif #endif
{ {
double hfsq,f,s,z,R,w,t1,t2,dk; double hfsq,f,s,z,R,w,t1,t2,dk;
__int32_t k,hx,i,j; int32_t k,hx,i,j;
__uint32_t lx; uint32_t lx;
EXTRACT_WORDS(hx,lx,x); EXTRACT_WORDS(hx,lx,x);
......
...@@ -106,9 +106,9 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ ...@@ -106,9 +106,9 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
{ {
double z,ax,z_h,z_l,p_h,p_l; double z,ax,z_h,z_l,p_h,p_l;
double y1,t1,t2,r,s,t,u,v,w; double y1,t1,t2,r,s,t,u,v,w;
__int32_t i,j,k,yisint,n; int32_t i,j,k,yisint,n;
__int32_t hx,hy,ix,iy; int32_t hx,hy,ix,iy;
__uint32_t lx,ly; uint32_t lx,ly;
EXTRACT_WORDS(hx,lx,x); EXTRACT_WORDS(hx,lx,x);
EXTRACT_WORDS(hy,ly,y); EXTRACT_WORDS(hy,ly,y);
...@@ -134,7 +134,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ ...@@ -134,7 +134,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
k = (iy>>20)-0x3ff; /* exponent */ k = (iy>>20)-0x3ff; /* exponent */
if(k>20) { if(k>20) {
j = ly>>(52-k); j = ly>>(52-k);
if((__uint32_t)(j<<(52-k))==ly) yisint = 2-(j&1); if((uint32_t)(j<<(52-k))==ly) yisint = 2-(j&1);
} else if(ly==0) { } else if(ly==0) {
j = iy>>(20-k); j = iy>>(20-k);
if((j<<(20-k))==iy) yisint = 2-(j&1); if((j<<(20-k))==iy) yisint = 2-(j&1);
...@@ -183,7 +183,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ ...@@ -183,7 +183,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
if((((hx>>31)+1)|yisint)==0) return (x-x)/(x-x); if((((hx>>31)+1)|yisint)==0) return (x-x)/(x-x);
but ANSI C says a right shift of a signed negative quantity is but ANSI C says a right shift of a signed negative quantity is
implementation defined. */ implementation defined. */
if(((((__uint32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); if(((((uint32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
/* |y| is huge */ /* |y| is huge */
if(iy>0x41e00000) { /* if |y| > 2**31 */ if(iy>0x41e00000) { /* if |y| > 2**31 */
...@@ -254,7 +254,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ ...@@ -254,7 +254,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
} }
s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
if(((((__uint32_t)hx>>31)-1)|(yisint-1))==0) if(((((uint32_t)hx>>31)-1)|(yisint-1))==0)
s = -one;/* (-ve)**(odd int) */ s = -one;/* (-ve)**(odd int) */
/* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
......
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
*/ */
#ifdef __STDC__ #ifdef __STDC__
static const __int32_t two_over_pi[] = { static const int32_t two_over_pi[] = {
#else #else
static __int32_t two_over_pi[] = { static int32_t two_over_pi[] = {
#endif #endif
0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62,
0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, 0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A,
...@@ -44,9 +44,9 @@ static __int32_t two_over_pi[] = { ...@@ -44,9 +44,9 @@ static __int32_t two_over_pi[] = {
}; };
#ifdef __STDC__ #ifdef __STDC__
static const __int32_t npio2_hw[] = { static const int32_t npio2_hw[] = {
#else #else
static __int32_t npio2_hw[] = { static int32_t npio2_hw[] = {
#endif #endif
0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, 0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C,
0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, 0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C,
...@@ -83,17 +83,17 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ ...@@ -83,17 +83,17 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
#ifdef __STDC__ #ifdef __STDC__
__int32_t __ieee754_rem_pio2(double x, double *y) int32_t __ieee754_rem_pio2(double x, double *y)
#else #else
__int32_t __ieee754_rem_pio2(x,y) int32_t __ieee754_rem_pio2(x,y)
double x,y[]; double x,y[];
#endif #endif
{ {
double z,w,t,r,fn; double z,w,t,r,fn;
double tx[3]; double tx[3];
__int32_t i,j,n,ix,hx; int32_t i,j,n,ix,hx;
int e0,nx; int e0,nx;
__uint32_t low; uint32_t low;
GET_HIGH_WORD(hx,x); /* high word of x */ GET_HIGH_WORD(hx,x); /* high word of x */
ix = hx&0x7fffffff; ix = hx&0x7fffffff;
...@@ -126,14 +126,14 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ ...@@ -126,14 +126,14 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
} }
if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */
t = fabs(x); t = fabs(x);
n = (__int32_t) (t*invpio2+half); n = (int32_t) (t*invpio2+half);
fn = (double)n; fn = (double)n;
r = t-fn*pio2_1; r = t-fn*pio2_1;
w = fn*pio2_1t; /* 1st round good to 85 bit */ w = fn*pio2_1t; /* 1st round good to 85 bit */
if(n<32&&ix!=npio2_hw[n-1]) { if(n<32&&ix!=npio2_hw[n-1]) {
y[0] = r-w; /* quick check no cancellation */ y[0] = r-w; /* quick check no cancellation */
} else { } else {
__uint32_t high; uint32_t high;
j = ix>>20; j = ix>>20;
y[0] = r-w; y[0] = r-w;
GET_HIGH_WORD(high,y[0]); GET_HIGH_WORD(high,y[0]);
...@@ -169,9 +169,9 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ ...@@ -169,9 +169,9 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
GET_LOW_WORD(low,x); GET_LOW_WORD(low,x);
SET_LOW_WORD(z,low); SET_LOW_WORD(z,low);
e0 = (int)((ix>>20)-1046); /* e0 = ilogb(z)-23; */ e0 = (int)((ix>>20)-1046); /* e0 = ilogb(z)-23; */
SET_HIGH_WORD(z, ix - ((__int32_t)e0<<20)); SET_HIGH_WORD(z, ix - ((int32_t)e0<<20));
for(i=0;i<2;i++) { for(i=0;i<2;i++) {
tx[i] = (double)((__int32_t)(z)); tx[i] = (double)((int32_t)(z));
z = (z-tx[i])*two24; z = (z-tx[i])*two24;
} }
tx[2] = z; tx[2] = z;
......
...@@ -38,8 +38,8 @@ static double zero = 0.0; ...@@ -38,8 +38,8 @@ static double zero = 0.0;
double x,p; double x,p;
#endif #endif
{ {
__int32_t hx,hp; int32_t hx,hp;
__uint32_t sx,lx,lp; uint32_t sx,lx,lp;
double p_half; double p_half;
EXTRACT_WORDS(hx,lx,x); EXTRACT_WORDS(hx,lx,x);
......
...@@ -99,9 +99,9 @@ static double one = 1.0, tiny=1.0e-300; ...@@ -99,9 +99,9 @@ static double one = 1.0, tiny=1.0e-300;
#endif #endif
{ {
double z; double z;
__int32_t sign = (int)0x80000000; int32_t sign = (int)0x80000000;
__uint32_t r,t1,s1,ix1,q1; uint32_t r,t1,s1,ix1,q1;
__int32_t ix0,s0,q,m,t,i; int32_t ix0,s0,q,m,t,i;
EXTRACT_WORDS(ix0,ix1,x); EXTRACT_WORDS(ix0,ix1,x);
...@@ -160,7 +160,7 @@ static double one = 1.0, tiny=1.0e-300; ...@@ -160,7 +160,7 @@ static double one = 1.0, tiny=1.0e-300;
t = s0; t = s0;
if((t<ix0)||((t==ix0)&&(t1<=ix1))) { if((t<ix0)||((t==ix0)&&(t1<=ix1))) {
s1 = t1+r; s1 = t1+r;
if(((t1&sign)==(__uint32_t)sign)&&(s1&sign)==0) s0 += 1; if(((t1&sign)==(uint32_t)sign)&&(s1&sign)==0) s0 += 1;
ix0 -= t; ix0 -= t;
if (ix1 < t1) ix0 -= 1; if (ix1 < t1) ix0 -= 1;
ix1 -= t1; ix1 -= t1;
...@@ -176,9 +176,9 @@ static double one = 1.0, tiny=1.0e-300; ...@@ -176,9 +176,9 @@ static double one = 1.0, tiny=1.0e-300;
z = one-tiny; /* trigger inexact flag */ z = one-tiny; /* trigger inexact flag */
if (z>=one) { if (z>=one) {
z = one+tiny; z = one+tiny;
if (q1==(__uint32_t)0xffffffff) { q1=0; q += 1;} if (q1==(uint32_t)0xffffffff) { q1=0; q += 1;}
else if (z>one) { else if (z>one) {
if (q1==(__uint32_t)0xfffffffe) q+=1; if (q1==(uint32_t)0xfffffffe) q+=1;
q1+=2; q1+=2;
} else } else
q1 += (q1&1); q1 += (q1&1);
......
...@@ -71,7 +71,7 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ ...@@ -71,7 +71,7 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */
#endif #endif
{ {
double a,hz,z,r,qx; double a,hz,z,r,qx;
__int32_t ix; int32_t ix;
GET_HIGH_WORD(ix,x); GET_HIGH_WORD(ix,x);
ix &= 0x7fffffff; /* ix = |x|'s high word*/ ix &= 0x7fffffff; /* ix = |x|'s high word*/
if(ix<0x3e400000) { /* if x < 2**27 */ if(ix<0x3e400000) { /* if x < 2**27 */
......
...@@ -163,13 +163,13 @@ two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ ...@@ -163,13 +163,13 @@ two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
#ifdef __STDC__ #ifdef __STDC__
int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const __int32_t *ipio2) int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2)
#else #else
int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
double x[], y[]; int e0,nx,prec; __int32_t ipio2[]; double x[], y[]; int e0,nx,prec; int32_t ipio2[];
#endif #endif
{ {
__int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
double z,fw,f[20],fq[20],q[20]; double z,fw,f[20],fq[20],q[20];
/* initialize jk*/ /* initialize jk*/
...@@ -194,15 +194,15 @@ twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ ...@@ -194,15 +194,15 @@ twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
recompute: recompute:
/* distill q[] into iq[] reversingly */ /* distill q[] into iq[] reversingly */
for(i=0,j=jz,z=q[jz];j>0;i++,j--) { for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
fw = (double)((__int32_t)(twon24* z)); fw = (double)((int32_t)(twon24* z));
iq[i] = (__int32_t)(z-two24*fw); iq[i] = (int32_t)(z-two24*fw);
z = q[j-1]+fw; z = q[j-1]+fw;
} }
/* compute n */ /* compute n */
z = scalbn(z,(int)q0); /* actual value of z */ z = scalbn(z,(int)q0); /* actual value of z */
z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */ z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */
n = (__int32_t) z; n = (int32_t) z;
z -= (double)n; z -= (double)n;
ih = 0; ih = 0;
if(q0>0) { /* need iq[jz-1] to determine n */ if(q0>0) { /* need iq[jz-1] to determine n */
...@@ -261,11 +261,11 @@ recompute: ...@@ -261,11 +261,11 @@ recompute:
} else { /* break z into 24-bit if necessary */ } else { /* break z into 24-bit if necessary */
z = scalbn(z,-(int)q0); z = scalbn(z,-(int)q0);
if(z>=two24) { if(z>=two24) {
fw = (double)((__int32_t)(twon24*z)); fw = (double)((int32_t)(twon24*z));
iq[jz] = (__int32_t)(z-two24*fw); iq[jz] = (int32_t)(z-two24*fw);
jz += 1; q0 += 24; jz += 1; q0 += 24;
iq[jz] = (__int32_t) fw; iq[jz] = (int32_t) fw;
} else iq[jz] = (__int32_t) z ; } else iq[jz] = (int32_t) z ;
} }
/* convert integer "bit" chunk to floating-point value */ /* convert integer "bit" chunk to floating-point value */
......
...@@ -64,7 +64,7 @@ S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ ...@@ -64,7 +64,7 @@ S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */
#endif #endif
{ {
double z,r,v; double z,r,v;
__int32_t ix; int32_t ix;
GET_HIGH_WORD(ix,x); GET_HIGH_WORD(ix,x);
ix &= 0x7fffffff; /* high word of x */ ix &= 0x7fffffff; /* high word of x */
if(ix<0x3e400000) /* |x| < 2**-27 */ if(ix<0x3e400000) /* |x| < 2**-27 */
......
...@@ -81,12 +81,12 @@ T[] = { ...@@ -81,12 +81,12 @@ T[] = {
#endif #endif
{ {
double z,r,v,w,s; double z,r,v,w,s;
__int32_t ix,hx; int32_t ix,hx;
GET_HIGH_WORD(hx,x); GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff; /* high word of |x| */ ix = hx&0x7fffffff; /* high word of |x| */
if(ix<0x3e300000) /* x < 2**-28 */ if(ix<0x3e300000) /* x < 2**-28 */
{if((int)x==0) { /* generate inexact */ {if((int)x==0) { /* generate inexact */
__uint32_t low; uint32_t low;
GET_LOW_WORD(low,x); GET_LOW_WORD(low,x);
if(((ix|low)|(iy+1))==0) return one/fabs(x); if(((ix|low)|(iy+1))==0) return one/fabs(x);
else return (iy==1)? x: -one/x; else return (iy==1)? x: -one/x;
......
...@@ -37,13 +37,35 @@ extern "C" { ...@@ -37,13 +37,35 @@ extern "C" {
// #include <float.h> // #include <float.h>
// #include <errno.h> // #include <errno.h>
/* These typedefs are true for the targets running Java. */ #if defined HAVE_STDINT_H
#include <stdint.h>
#elif defined HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if defined HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifndef HAVE_INT32_DEFINED #if defined HAVE_SYS_CONFIG_H
typedef int __int32_t; #include <sys/config.h>
typedef unsigned int __uint32_t;
#endif #endif
/* ISO C9X int type declarations */
#if !defined HAVE_INT32_DEFINED && defined HAVE_BSD_INT32_DEFINED
typedef u_int32_t uint32_t;
#endif
#if !defined HAVE_BSD_INT32_DEFINED && !defined HAVE_INT32_DEFINED
// FIXME -- this could have problems with systems that don't define SI to be 4
typedef int int32_t __attribute__((mode(SI)));
typedef unsigned int uint32_t __attribute__((mode(SI)));
#endif
/* These typedefs are true for the targets running Java. */
#ifdef __IEEE_LITTLE_ENDIAN #ifdef __IEEE_LITTLE_ENDIAN
#define IEEE_8087 #define IEEE_8087
#endif #endif
...@@ -63,7 +85,7 @@ typedef unsigned int __uint32_t; ...@@ -63,7 +85,7 @@ typedef unsigned int __uint32_t;
#ifdef Unsigned_Shifts #ifdef Unsigned_Shifts
#define Sign_Extend(a,b) if (b < 0) a |= (__uint32_t)0xffff0000; #define Sign_Extend(a,b) if (b < 0) a |= (uint32_t)0xffff0000;
#else #else
#define Sign_Extend(a,b) /*no-op*/ #define Sign_Extend(a,b) /*no-op*/
#endif #endif
...@@ -79,8 +101,7 @@ Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. ...@@ -79,8 +101,7 @@ Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
union double_union union double_union
{ {
double d; double d;
// FIXME: This should be some well-defined 32 bit type. uint32_t i[2];
__uint32_t i[2];
}; };
#ifdef IEEE_8087 #ifdef IEEE_8087
...@@ -113,34 +134,34 @@ union double_union ...@@ -113,34 +134,34 @@ union double_union
#if defined (_DOUBLE_IS_32BITS) #if defined (_DOUBLE_IS_32BITS)
#define Exp_shift 23 #define Exp_shift 23
#define Exp_shift1 23 #define Exp_shift1 23
#define Exp_msk1 ((__uint32_t)0x00800000L) #define Exp_msk1 ((uint32_t)0x00800000L)
#define Exp_msk11 ((__uint32_t)0x00800000L) #define Exp_msk11 ((uint32_t)0x00800000L)
#define Exp_mask ((__uint32_t)0x7f800000L) #define Exp_mask ((uint32_t)0x7f800000L)
#define P 24 #define P 24
#define Bias 127 #define Bias 127
#if 0 #if 0
#define IEEE_Arith /* it is, but the code doesn't handle IEEE singles yet */ #define IEEE_Arith /* it is, but the code doesn't handle IEEE singles yet */
#endif #endif
#define Emin (-126) #define Emin (-126)
#define Exp_1 ((__uint32_t)0x3f800000L) #define Exp_1 ((uint32_t)0x3f800000L)
#define Exp_11 ((__uint32_t)0x3f800000L) #define Exp_11 ((uint32_t)0x3f800000L)
#define Ebits 8 #define Ebits 8
#define Frac_mask ((__uint32_t)0x007fffffL) #define Frac_mask ((uint32_t)0x007fffffL)
#define Frac_mask1 ((__uint32_t)0x007fffffL) #define Frac_mask1 ((uint32_t)0x007fffffL)
#define Ten_pmax 10 #define Ten_pmax 10
#define Sign_bit ((__uint32_t)0x80000000L) #define Sign_bit ((uint32_t)0x80000000L)
#define Ten_pmax 10 #define Ten_pmax 10
#define Bletch 2 #define Bletch 2
#define Bndry_mask ((__uint32_t)0x007fffffL) #define Bndry_mask ((uint32_t)0x007fffffL)
#define Bndry_mask1 ((__uint32_t)0x007fffffL) #define Bndry_mask1 ((uint32_t)0x007fffffL)
#define LSB 1 #define LSB 1
#define Sign_bit ((__uint32_t)0x80000000L) #define Sign_bit ((uint32_t)0x80000000L)
#define Log2P 1 #define Log2P 1
#define Tiny0 0 #define Tiny0 0
#define Tiny1 1 #define Tiny1 1
#define Quick_max 5 #define Quick_max 5
#define Int_max 6 #define Int_max 6
#define Infinite(x) (word0(x) == ((__uint32_t)0x7f800000L)) #define Infinite(x) (word0(x) == ((uint32_t)0x7f800000L))
#undef word0 #undef word0
#undef word1 #undef word1
...@@ -150,30 +171,30 @@ union double_union ...@@ -150,30 +171,30 @@ union double_union
#define Exp_shift 20 #define Exp_shift 20
#define Exp_shift1 20 #define Exp_shift1 20
#define Exp_msk1 ((__uint32_t)0x100000L) #define Exp_msk1 ((uint32_t)0x100000L)
#define Exp_msk11 ((__uint32_t)0x100000L) #define Exp_msk11 ((uint32_t)0x100000L)
#define Exp_mask ((__uint32_t)0x7ff00000L) #define Exp_mask ((uint32_t)0x7ff00000L)
#define P 53 #define P 53
#define Bias 1023 #define Bias 1023
#define IEEE_Arith #define IEEE_Arith
#define Emin (-1022) #define Emin (-1022)
#define Exp_1 ((__uint32_t)0x3ff00000L) #define Exp_1 ((uint32_t)0x3ff00000L)
#define Exp_11 ((__uint32_t)0x3ff00000L) #define Exp_11 ((uint32_t)0x3ff00000L)
#define Ebits 11 #define Ebits 11
#define Frac_mask ((__uint32_t)0xfffffL) #define Frac_mask ((uint32_t)0xfffffL)
#define Frac_mask1 ((__uint32_t)0xfffffL) #define Frac_mask1 ((uint32_t)0xfffffL)
#define Ten_pmax 22 #define Ten_pmax 22
#define Bletch 0x10 #define Bletch 0x10
#define Bndry_mask ((__uint32_t)0xfffffL) #define Bndry_mask ((uint32_t)0xfffffL)
#define Bndry_mask1 ((__uint32_t)0xfffffL) #define Bndry_mask1 ((uint32_t)0xfffffL)
#define LSB 1 #define LSB 1
#define Sign_bit ((__uint32_t)0x80000000L) #define Sign_bit ((uint32_t)0x80000000L)
#define Log2P 1 #define Log2P 1
#define Tiny0 0 #define Tiny0 0
#define Tiny1 1 #define Tiny1 1
#define Quick_max 14 #define Quick_max 14
#define Int_max 14 #define Int_max 14
#define Infinite(x) (word0(x) == ((__uint32_t)0x7ff00000L)) /* sufficient test for here */ #define Infinite(x) (word0(x) == ((uint32_t)0x7ff00000L)) /* sufficient test for here */
#endif #endif
#else #else
...@@ -182,24 +203,24 @@ union double_union ...@@ -182,24 +203,24 @@ union double_union
#ifdef IBM #ifdef IBM
#define Exp_shift 24 #define Exp_shift 24
#define Exp_shift1 24 #define Exp_shift1 24
#define Exp_msk1 ((__uint32_t)0x1000000L) #define Exp_msk1 ((uint32_t)0x1000000L)
#define Exp_msk11 ((__uint32_t)0x1000000L) #define Exp_msk11 ((uint32_t)0x1000000L)
#define Exp_mask ((__uint32_t)0x7f000000L) #define Exp_mask ((uint32_t)0x7f000000L)
#define P 14 #define P 14
#define Bias 65 #define Bias 65
#define Exp_1 ((__uint32_t)0x41000000L) #define Exp_1 ((uint32_t)0x41000000L)
#define Exp_11 ((__uint32_t)0x41000000L) #define Exp_11 ((uint32_t)0x41000000L)
#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */ #define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */
#define Frac_mask ((__uint32_t)0xffffffL) #define Frac_mask ((uint32_t)0xffffffL)
#define Frac_mask1 ((__uint32_t)0xffffffL) #define Frac_mask1 ((uint32_t)0xffffffL)
#define Bletch 4 #define Bletch 4
#define Ten_pmax 22 #define Ten_pmax 22
#define Bndry_mask ((__uint32_t)0xefffffL) #define Bndry_mask ((uint32_t)0xefffffL)
#define Bndry_mask1 ((__uint32_t)0xffffffL) #define Bndry_mask1 ((uint32_t)0xffffffL)
#define LSB 1 #define LSB 1
#define Sign_bit ((__uint32_t)0x80000000L) #define Sign_bit ((uint32_t)0x80000000L)
#define Log2P 4 #define Log2P 4
#define Tiny0 ((__uint32_t)0x100000L) #define Tiny0 ((uint32_t)0x100000L)
#define Tiny1 0 #define Tiny1 0
#define Quick_max 14 #define Quick_max 14
#define Int_max 15 #define Int_max 15
...@@ -207,21 +228,21 @@ union double_union ...@@ -207,21 +228,21 @@ union double_union
#define Exp_shift 23 #define Exp_shift 23
#define Exp_shift1 7 #define Exp_shift1 7
#define Exp_msk1 0x80 #define Exp_msk1 0x80
#define Exp_msk11 ((__uint32_t)0x800000L) #define Exp_msk11 ((uint32_t)0x800000L)
#define Exp_mask ((__uint32_t)0x7f80L) #define Exp_mask ((uint32_t)0x7f80L)
#define P 56 #define P 56
#define Bias 129 #define Bias 129
#define Exp_1 ((__uint32_t)0x40800000L) #define Exp_1 ((uint32_t)0x40800000L)
#define Exp_11 ((__uint32_t)0x4080L) #define Exp_11 ((uint32_t)0x4080L)
#define Ebits 8 #define Ebits 8
#define Frac_mask ((__uint32_t)0x7fffffL) #define Frac_mask ((uint32_t)0x7fffffL)
#define Frac_mask1 ((__uint32_t)0xffff007fL) #define Frac_mask1 ((uint32_t)0xffff007fL)
#define Ten_pmax 24 #define Ten_pmax 24
#define Bletch 2 #define Bletch 2
#define Bndry_mask ((__uint32_t)0xffff007fL) #define Bndry_mask ((uint32_t)0xffff007fL)
#define Bndry_mask1 ((__uint32_t)0xffff007fL) #define Bndry_mask1 ((uint32_t)0xffff007fL)
#define LSB ((__uint32_t)0x10000L) #define LSB ((uint32_t)0x10000L)
#define Sign_bit ((__uint32_t)0x8000L) #define Sign_bit ((uint32_t)0x8000L)
#define Log2P 1 #define Log2P 1
#define Tiny0 0x80 #define Tiny0 0x80
#define Tiny1 0 #define Tiny1 0
...@@ -248,7 +269,7 @@ extern double rnd_prod(double, double), rnd_quot(double, double); ...@@ -248,7 +269,7 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
#endif #endif
#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
#define Big1 ((__uint32_t)0xffffffffL) #define Big1 ((uint32_t)0xffffffffL)
#ifndef Just_16 #ifndef Just_16
/* When Pack_32 is not defined, we store 16 bits per 32-bit long. /* When Pack_32 is not defined, we store 16 bits per 32-bit long.
...@@ -371,4 +392,3 @@ extern _CONST double tens[]; ...@@ -371,4 +392,3 @@ extern _CONST double tens[];
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
...@@ -133,12 +133,12 @@ huge = 1.0e300; ...@@ -133,12 +133,12 @@ huge = 1.0e300;
#endif #endif
{ {
double w,s1,s2,z; double w,s1,s2,z;
__int32_t ix,hx,id; int32_t ix,hx,id;
GET_HIGH_WORD(hx,x); GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff; ix = hx&0x7fffffff;
if(ix>=0x44100000) { /* if |x| >= 2^66 */ if(ix>=0x44100000) { /* if |x| >= 2^66 */
__uint32_t low; uint32_t low;
GET_LOW_WORD(low,x); GET_LOW_WORD(low,x);
if(ix>0x7ff00000|| if(ix>0x7ff00000||
(ix==0x7ff00000&&(low!=0))) (ix==0x7ff00000&&(low!=0)))
......
...@@ -37,8 +37,8 @@ static double huge = 1.0e300; ...@@ -37,8 +37,8 @@ static double huge = 1.0e300;
double x; double x;
#endif #endif
{ {
__int32_t i0,i1,j0; int32_t i0,i1,j0;
__uint32_t i,j; uint32_t i,j;
EXTRACT_WORDS(i0,i1,x); EXTRACT_WORDS(i0,i1,x);
j0 = ((i0>>20)&0x7ff)-0x3ff; j0 = ((i0>>20)&0x7ff)-0x3ff;
if(j0<20) { if(j0<20) {
...@@ -59,14 +59,14 @@ static double huge = 1.0e300; ...@@ -59,14 +59,14 @@ static double huge = 1.0e300;
if(j0==0x400) return x+x; /* inf or NaN */ if(j0==0x400) return x+x; /* inf or NaN */
else return x; /* x is integral */ else return x; /* x is integral */
} else { } else {
i = ((__uint32_t)(0xffffffff))>>(j0-20); i = ((uint32_t)(0xffffffff))>>(j0-20);
if((i1&i)==0) return x; /* x is integral */ if((i1&i)==0) return x; /* x is integral */
if(huge+x>0.0) { /* raise inexact flag */ if(huge+x>0.0) { /* raise inexact flag */
if(i0>0) { if(i0>0) {
if(j0==20) i0+=1; if(j0==20) i0+=1;
else { else {
j = i1 + (1<<(52-j0)); j = i1 + (1<<(52-j0));
if(j<(__uint32_t)i1) i0+=1; /* got a carry */ if(j<(uint32_t)i1) i0+=1; /* got a carry */
i1 = j; i1 = j;
} }
} }
......
...@@ -72,7 +72,7 @@ Definition (Issue 2). ...@@ -72,7 +72,7 @@ Definition (Issue 2).
double x,y; double x,y;
#endif #endif
{ {
__uint32_t hx,hy; uint32_t hx,hy;
GET_HIGH_WORD(hx,x); GET_HIGH_WORD(hx,x);
GET_HIGH_WORD(hy,y); GET_HIGH_WORD(hy,y);
SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000)); SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#endif #endif
{ {
double y[2],z=0.0; double y[2],z=0.0;
__int32_t n,ix; int32_t n,ix;
/* High word of x. */ /* High word of x. */
GET_HIGH_WORD(ix,x); GET_HIGH_WORD(ix,x);
......
...@@ -64,7 +64,7 @@ PORTABILITY ...@@ -64,7 +64,7 @@ PORTABILITY
double x; double x;
#endif #endif
{ {
__uint32_t high; uint32_t high;
GET_HIGH_WORD(high,x); GET_HIGH_WORD(high,x);
SET_HIGH_WORD(x,high&0x7fffffff); SET_HIGH_WORD(x,high&0x7fffffff);
return x; return x;
......
...@@ -90,8 +90,8 @@ static double huge = 1.0e300; ...@@ -90,8 +90,8 @@ static double huge = 1.0e300;
double x; double x;
#endif #endif
{ {
__int32_t i0,i1,j0; int32_t i0,i1,j0;
__uint32_t i,j; uint32_t i,j;
EXTRACT_WORDS(i0,i1,x); EXTRACT_WORDS(i0,i1,x);
j0 = ((i0>>20)&0x7ff)-0x3ff; j0 = ((i0>>20)&0x7ff)-0x3ff;
if(j0<20) { if(j0<20) {
...@@ -113,14 +113,14 @@ static double huge = 1.0e300; ...@@ -113,14 +113,14 @@ static double huge = 1.0e300;
if(j0==0x400) return x+x; /* inf or NaN */ if(j0==0x400) return x+x; /* inf or NaN */
else return x; /* x is integral */ else return x; /* x is integral */
} else { } else {
i = ((__uint32_t)(0xffffffff))>>(j0-20); i = ((uint32_t)(0xffffffff))>>(j0-20);
if((i1&i)==0) return x; /* x is integral */ if((i1&i)==0) return x; /* x is integral */
if(huge+x>0.0) { /* raise inexact flag */ if(huge+x>0.0) { /* raise inexact flag */
if(i0<0) { if(i0<0) {
if(j0==20) i0+=1; if(j0==20) i0+=1;
else { else {
j = i1+(1<<(52-j0)); j = i1+(1<<(52-j0));
if(j<(__uint32_t)i1) i0 +=1 ; /* got a carry */ if(j<(uint32_t)i1) i0 +=1 ; /* got a carry */
i1=j; i1=j;
} }
} }
......
...@@ -42,8 +42,8 @@ TWO52[2]={ ...@@ -42,8 +42,8 @@ TWO52[2]={
double x; double x;
#endif #endif
{ {
__int32_t i0,j0,sx; int32_t i0,j0,sx;
__uint32_t i,i1; uint32_t i,i1;
double t; double t;
volatile double w; volatile double w;
EXTRACT_WORDS(i0,i1,x); EXTRACT_WORDS(i0,i1,x);
...@@ -74,7 +74,7 @@ TWO52[2]={ ...@@ -74,7 +74,7 @@ TWO52[2]={
if(j0==0x400) return x+x; /* inf or NaN */ if(j0==0x400) return x+x; /* inf or NaN */
else return x; /* x is integral */ else return x; /* x is integral */
} else { } else {
i = ((__uint32_t)(0xffffffff))>>(j0-20); i = ((uint32_t)(0xffffffff))>>(j0-20);
if((i1&i)==0) return x; /* x is integral */ if((i1&i)==0) return x; /* x is integral */
i>>=1; i>>=1;
if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20)); if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
......
...@@ -76,7 +76,7 @@ tiny = 1.0e-300; ...@@ -76,7 +76,7 @@ tiny = 1.0e-300;
double x; int n; double x; int n;
#endif #endif
{ {
__int32_t k,hx,lx; int32_t k,hx,lx;
EXTRACT_WORDS(hx,lx,x); EXTRACT_WORDS(hx,lx,x);
k = (hx&0x7ff00000)>>20; /* extract exponent */ k = (hx&0x7ff00000)>>20; /* extract exponent */
if (k==0) { /* 0 or subnormal x */ if (k==0) { /* 0 or subnormal x */
......
...@@ -104,7 +104,7 @@ QUICKREF ...@@ -104,7 +104,7 @@ QUICKREF
#endif #endif
{ {
double y[2],z=0.0; double y[2],z=0.0;
__int32_t n,ix; int32_t n,ix;
/* High word of x. */ /* High word of x. */
GET_HIGH_WORD(ix,x); GET_HIGH_WORD(ix,x);
......
...@@ -91,7 +91,7 @@ PORTABILITY ...@@ -91,7 +91,7 @@ PORTABILITY
#endif #endif
{ {
double y[2],z=0.0; double y[2],z=0.0;
__int32_t n,ix; int32_t n,ix;
/* High word of x. */ /* High word of x. */
GET_HIGH_WORD(ix,x); GET_HIGH_WORD(ix,x);
......
...@@ -32,8 +32,8 @@ TWO23[2]={ ...@@ -32,8 +32,8 @@ TWO23[2]={
float x; float x;
#endif #endif
{ {
__int32_t i0,j0,sx; int32_t i0,j0,sx;
__uint32_t i,i1; uint32_t i,i1;
float w,t; float w,t;
GET_FLOAT_WORD(i0,x); GET_FLOAT_WORD(i0,x);
sx = (i0>>31)&1; sx = (i0>>31)&1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment