Use a union to access the words of a double as this is less likely

to cause bugs when gcc is more aggressively optimising things.

There are still problems with dtoa mentioned in the PR - maybe
Dan could suggest a patch.

PR:		40209
Submitted by:	Dan Lukes <dan@obluda.cz>
Approved by:	bde
MFC after:	2 weeks
This commit is contained in:
dwmalone 2002-08-13 14:17:39 +00:00
parent 29063da0fa
commit e3390526f7

View File

@ -222,12 +222,16 @@ extern "C" {
Only one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined.
#endif
union doubleasulongs {
double x;
ULong w[2];
};
#ifdef IEEE_LITTLE_ENDIAN
#define word0(x) ((ULong *)&x)[1]
#define word1(x) ((ULong *)&x)[0]
#define word0(x) (((union doubleasulongs *)&x)->w)[1]
#define word1(x) (((union doubleasulongs *)&x)->w)[0]
#else
#define word0(x) ((ULong *)&x)[0]
#define word1(x) ((ULong *)&x)[1]
#define word0(x) (((union doubleasulongs *)&x)->w)[0]
#define word1(x) (((union doubleasulongs *)&x)->w)[1]
#endif
/* The following definition of Storeinc is appropriate for MIPS processors.