Use an intermediate pointer to avoid a strict aliasing warning.

Note that ULong in this code is actually defined as an unsigned integer across
all arches so that the gdtoa() function always processes 32 bit data
despite the unfortunate naming of "ULong".
This commit is contained in:
John Birrell 2007-11-21 01:10:42 +00:00
parent 8463d7a051
commit 3e636fa0e5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173793

View File

@ -61,6 +61,7 @@ __ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign,
char *ret;
union IEEEl2bits u;
uint32_t bits[(LDBL_MANT_DIG + 31) / 32];
void *vbits = bits;
u.e = *ld;
*sign = u.bits.sign;
@ -93,7 +94,7 @@ __ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign,
abort();
}
ret = gdtoa(&fpi, be, (ULong *)bits, &kind, mode, ndigits, decpt, rve);
ret = gdtoa(&fpi, be, vbits, &kind, mode, ndigits, decpt, rve);
if (*decpt == -32768)
*decpt = INT_MAX;
return ret;