2007-08-31 Antony King <antony.king@st.com>

* libc/stdlib/mprec.h [_DOUBLE_IS_32BITS}: Define IEEE_Arith
        bits and redefine associated dword0 macro (rvalue issue).
        * libc/stdio/vfieeefp.h: Ditto.
        * libc/stdlib/strtod.c: Add checks for _DOUBLE_IS_32BITS
        to prevent setting dword1 which is an rvalue only.
This commit is contained in:
Jeff Johnston 2007-08-31 21:21:27 +00:00
parent 95500c2eff
commit 6ddf8bef40
4 changed files with 25 additions and 13 deletions

View File

@ -1,3 +1,11 @@
2007-08-31 Antony King <antony.king@st.com>
* libc/stdlib/mprec.h [_DOUBLE_IS_32BITS}: Define IEEE_Arith
bits and redefine associated dword0 macro (rvalue issue).
* libc/stdio/vfieeefp.h: Ditto.
* libc/stdlib/strtod.c: Add checks for _DOUBLE_IS_32BITS
to prevent setting dword1 which is an rvalue only.
2007-08-28 Hans Kester <hans.kester@ellips.nl> 2007-08-28 Hans Kester <hans.kester@ellips.nl>
* configure.host: Added support for x86_64. * configure.host: Added support for x86_64.

View File

@ -170,9 +170,7 @@ union double_union
#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 #define IEEE_Arith
#define IEEE_Arith /* it is, but the code doesn't handle IEEE singles yet */
#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)

View File

@ -139,15 +139,7 @@ typedef union { double d; __ULong L[2]; } U;
#define P 24 #define P 24
#define Bias 127 #define Bias 127
#define NO_HEX_FP /* not supported in this case */ #define NO_HEX_FP /* not supported in this case */
#if 0 #define IEEE_Arith
#define IEEE_Arith /* it is, but the code doesn't handle IEEE singles yet */
#endif
/* Following is needed due to IEEE_Arith not being set on above. */
#if defined(__v800)
#define n_bigtens 2
#else
#define n_bigtens 5
#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)
@ -175,7 +167,11 @@ typedef union { double d; __ULong L[2]; } U;
#define word0(x) (x.i[0]) #define word0(x) (x.i[0])
#define word1(x) 0 #define word1(x) 0
#ifdef YES_ALIAS
#define dword0(x) ((__ULong *)&x)[0] #define dword0(x) ((__ULong *)&x)[0]
#else
#define dword0(x) ((U*)&x)->L[0]
#endif
#define dword1(x) 0 #define dword1(x) 0
#else #else

View File

@ -386,7 +386,9 @@ _DEFUN (_strtod_r, (ptr, s00, se),
if (!match(&s,"inity")) if (!match(&s,"inity"))
++s; ++s;
dword0(rv) = 0x7ff00000; dword0(rv) = 0x7ff00000;
#ifndef _DOUBLE_IS_32BITS
dword1(rv) = 0; dword1(rv) = 0;
#endif /*!_DOUBLE_IS_32BITS*/
goto ret; goto ret;
} }
break; break;
@ -398,12 +400,16 @@ _DEFUN (_strtod_r, (ptr, s00, se),
&& hexnan(&s, &fpinan, bits) && hexnan(&s, &fpinan, bits)
== STRTOG_NaNbits) { == STRTOG_NaNbits) {
dword0(rv) = 0x7ff00000 | bits[1]; dword0(rv) = 0x7ff00000 | bits[1];
#ifndef _DOUBLE_IS_32BITS
dword1(rv) = bits[0]; dword1(rv) = bits[0];
#endif /*!_DOUBLE_IS_32BITS*/
} }
else { else {
#endif #endif
dword0(rv) = NAN_WORD0; dword0(rv) = NAN_WORD0;
#ifndef _DOUBLE_IS_32BITS
dword1(rv) = NAN_WORD1; dword1(rv) = NAN_WORD1;
#endif /*!_DOUBLE_IS_32BITS*/
#ifndef No_Hex_NaN #ifndef No_Hex_NaN
} }
#endif #endif
@ -627,8 +633,8 @@ _DEFUN (_strtod_r, (ptr, s00, se),
#ifndef _DOUBLE_IS_32BITS #ifndef _DOUBLE_IS_32BITS
else else
dword1(rv) &= 0xffffffff << j; dword1(rv) &= 0xffffffff << j;
}
#endif /*!_DOUBLE_IS_32BITS*/ #endif /*!_DOUBLE_IS_32BITS*/
}
#else #else
for(j = 0; e1 > 1; j++, e1 >>= 1) for(j = 0; e1 > 1; j++, e1 >>= 1)
if (e1 & 1) if (e1 & 1)
@ -1109,7 +1115,9 @@ _DEFUN (_strtod_r, (ptr, s00, se),
if (inexact) { if (inexact) {
if (!oldinexact) { if (!oldinexact) {
dword0(rv0) = Exp_1 + (70 << Exp_shift); dword0(rv0) = Exp_1 + (70 << Exp_shift);
#ifndef _DOUBLE_IS_32BITS
dword1(rv0) = 0; dword1(rv0) = 0;
#endif /*!_DOUBLE_IS_32BITS*/
dval(rv0) += 1.; dval(rv0) += 1.;
} }
} }
@ -1119,7 +1127,9 @@ _DEFUN (_strtod_r, (ptr, s00, se),
#ifdef Avoid_Underflow #ifdef Avoid_Underflow
if (scale) { if (scale) {
dword0(rv0) = Exp_1 - 2*P*Exp_msk1; dword0(rv0) = Exp_1 - 2*P*Exp_msk1;
#ifndef _DOUBLE_IS_32BITS
dword1(rv0) = 0; dword1(rv0) = 0;
#endif /*!_DOUBLE_IS_32BITS*/
dval(rv) *= dval(rv0); dval(rv) *= dval(rv0);
#ifndef NO_ERRNO #ifndef NO_ERRNO
/* try to avoid the bug of testing an 8087 register value */ /* try to avoid the bug of testing an 8087 register value */