diff options
author | Alan Modra <amodra@gmail.com> | 2013-08-17 18:12:56 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2013-10-04 10:28:42 +0930 |
commit | 9605ca6c085a749f29b6866a3e00bce1ba1a2698 (patch) | |
tree | 3090d34c90df3fc6f68fc315d1c62e535c324480 /sysdeps/ieee754/ldbl-128ibm/printf_fphex.c | |
parent | d3d237560b858b3c07973a5261cd6903fe52909c (diff) | |
download | glibc-9605ca6c085a749f29b6866a3e00bce1ba1a2698.zip glibc-9605ca6c085a749f29b6866a3e00bce1ba1a2698.tar.gz glibc-9605ca6c085a749f29b6866a3e00bce1ba1a2698.tar.bz2 |
IBM long double mechanical changes to support little-endian
http://sourceware.org/ml/libc-alpha/2013-07/msg00001.html
This patch starts the process of supporting powerpc64 little-endian
long double in glibc. IBM long double is an array of two ieee
doubles, so making union ibm_extended_long_double reflect this fact is
the correct way to access fields of the doubles.
* sysdeps/ieee754/ldbl-128ibm/ieee754.h
(union ibm_extended_long_double): Define as an array of ieee754_double.
(IBM_EXTENDED_LONG_DOUBLE_BIAS): Delete.
* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c: Update all references
to ibm_extended_long_double and IBM_EXTENDED_LONG_DOUBLE_BIAS.
* sysdeps/ieee754/ldbl-128ibm/e_exp10l.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/e_expl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h: Likewise.
* sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/strtold_l.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c: Likewise.
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm/printf_fphex.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/printf_fphex.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c index 247dc20..3fe8333 100644 --- a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c +++ b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c @@ -26,31 +26,31 @@ do { \ unsigned long long int num0, num1; \ unsigned long long hi, lo; \ int ediff; \ - union ibm_extended_long_double eldbl; \ - eldbl.d = fpnum.ldbl.d; \ + union ibm_extended_long_double u; \ + u.ld = fpnum.ldbl.d; \ \ assert (sizeof (long double) == 16); \ \ - lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3; \ - hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1; \ + lo = ((long long)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1; \ + hi = ((long long)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1; \ lo <<= 7; /* pre-shift lo to match ieee854. */ \ /* If the lower double is not a denomal or zero then set the hidden \ 53rd bit. */ \ - if (eldbl.ieee.exponent2 != 0) \ + if (u.d[1].ieee.exponent != 0) \ lo |= (1ULL << (52 + 7)); \ else \ lo <<= 1; \ /* The lower double is normalized separately from the upper. We \ may need to adjust the lower manitissa to reflect this. */ \ - ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2; \ + ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent; \ if (ediff > 53 + 63) \ lo = 0; \ else if (ediff > 53) \ lo = lo >> (ediff - 53); \ - else if (eldbl.ieee.exponent2 == 0 && ediff < 53) \ + else if (u.d[1].ieee.exponent == 0 && ediff < 53) \ lo = lo << (53 - ediff); \ - if (eldbl.ieee.negative != eldbl.ieee.negative2 \ - && (eldbl.ieee.exponent2 != 0 || lo != 0L)) \ + if (u.d[0].ieee.negative != u.d[1].ieee.negative \ + && (u.d[1].ieee.exponent != 0 || lo != 0L)) \ { \ lo = (1ULL << 60) - lo; \ if (hi == 0L) \ @@ -58,7 +58,7 @@ do { \ /* we have a borrow from the hidden bit, so shift left 1. */ \ hi = 0xffffffffffffeLL | (lo >> 59); \ lo = 0xfffffffffffffffLL & (lo << 1); \ - eldbl.ieee.exponent--; \ + u.d[0].ieee.exponent--; \ } \ else \ hi--; \ @@ -109,9 +109,9 @@ do { \ *--wnumstr = L'0'; \ } \ \ - leading = eldbl.ieee.exponent == 0 ? '0' : '1'; \ + leading = u.d[0].ieee.exponent == 0 ? '0' : '1'; \ \ - exponent = eldbl.ieee.exponent; \ + exponent = u.d[0].ieee.exponent; \ \ if (exponent == 0) \ { \ @@ -121,18 +121,18 @@ do { \ { \ /* This is a denormalized number. */ \ expnegative = 1; \ - exponent = IBM_EXTENDED_LONG_DOUBLE_BIAS - 1; \ + exponent = IEEE754_DOUBLE_BIAS - 1; \ } \ } \ - else if (exponent >= IBM_EXTENDED_LONG_DOUBLE_BIAS) \ + else if (exponent >= IEEE754_DOUBLE_BIAS) \ { \ expnegative = 0; \ - exponent -= IBM_EXTENDED_LONG_DOUBLE_BIAS; \ + exponent -= IEEE754_DOUBLE_BIAS; \ } \ else \ { \ expnegative = 1; \ - exponent = -(exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS); \ + exponent = -(exponent - IEEE754_DOUBLE_BIAS); \ } \ } while (0) |