diff options
author | Alan Modra <amodra@gmail.com> | 2013-08-17 18:21:58 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2013-10-04 10:31:41 +0930 |
commit | 1b6adf888de14675bc3207578dcb7132ed5f8ecc (patch) | |
tree | d3f1bc0076f24429772ea316b624fcc5bf7bebd8 /sysdeps/ieee754/ldbl-128/printf_fphex.c | |
parent | 4cf69995e26e16005d4e3843ad4d18c75cf21a04 (diff) | |
download | glibc-1b6adf888de14675bc3207578dcb7132ed5f8ecc.tar.gz glibc-1b6adf888de14675bc3207578dcb7132ed5f8ecc.tar.xz glibc-1b6adf888de14675bc3207578dcb7132ed5f8ecc.zip |
PowerPC floating point little-endian [1 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00081.html This is the first of a series of patches to ban ieee854_long_double and the ieee854_long_double macros when using IBM long double. union ieee854_long_double just isn't correct for IBM long double, especially when little-endian, and pretending it is OK has allowed a number of bugs to remain undetected in sysdeps/ieee754/ldbl-128ibm/. This changes the few places in generic code that use it. * stdio-common/printf_size.c (__printf_size): Don't use union ieee854_long_double in fpnum union. * stdio-common/printf_fphex.c (__printf_fphex): Likewise. Use signbit macro to retrieve sign from long double. * stdio-common/printf_fp.c (___printf_fp): Use signbit macro to retrieve sign from long double. * sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Adjust for fpnum change. * sysdeps/ieee754/ldbl-128/printf_fphex.c: Likewise. * sysdeps/ieee754/ldbl-96/printf_fphex.c: Likewise. * sysdeps/x86_64/fpu/printf_fphex.c: Likewise. * math/test-misc.c (main): Don't use union ieee854_long_double. ports/ * sysdeps/ia64/fpu/printf_fphex.c: Adjust for fpnum change.
Diffstat (limited to 'sysdeps/ieee754/ldbl-128/printf_fphex.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128/printf_fphex.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sysdeps/ieee754/ldbl-128/printf_fphex.c b/sysdeps/ieee754/ldbl-128/printf_fphex.c index c9e09a4b74..e82228a53e 100644 --- a/sysdeps/ieee754/ldbl-128/printf_fphex.c +++ b/sysdeps/ieee754/ldbl-128/printf_fphex.c @@ -24,13 +24,15 @@ do { \ digits we use only the implicit digits for the number before \ the decimal point. */ \ unsigned long long int num0, num1; \ + union ieee854_long_double u; \ + u.d = fpnum.ldbl; \ \ assert (sizeof (long double) == 16); \ \ - num0 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32 \ - | fpnum.ldbl.ieee.mantissa1); \ - num1 = (((unsigned long long int) fpnum.ldbl.ieee.mantissa2) << 32 \ - | fpnum.ldbl.ieee.mantissa3); \ + num0 = (((unsigned long long int) u.ieee.mantissa0) << 32 \ + | u.ieee.mantissa1); \ + num1 = (((unsigned long long int) u.ieee.mantissa2) << 32 \ + | u.ieee.mantissa3); \ \ zero_mantissa = (num0|num1) == 0; \ \ @@ -75,9 +77,9 @@ do { \ *--wnumstr = L'0'; \ } \ \ - leading = fpnum.ldbl.ieee.exponent == 0 ? '0' : '1'; \ + leading = u.ieee.exponent == 0 ? '0' : '1'; \ \ - exponent = fpnum.ldbl.ieee.exponent; \ + exponent = u.ieee.exponent; \ \ if (exponent == 0) \ { \ |