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/ldbl2mpn.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/ldbl2mpn.c')
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c index 00e44b8..5149ba1 100644 --- a/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c +++ b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c @@ -36,22 +36,22 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, union ibm_extended_long_double u; unsigned long long hi, lo; int ediff; - u.d = value; + u.ld = value; - *is_neg = u.ieee.negative; - *expt = (int) u.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS; + *is_neg = u.d[0].ieee.negative; + *expt = (int) u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS; - lo = ((long long) u.ieee.mantissa2 << 32) | u.ieee.mantissa3; - hi = ((long long) u.ieee.mantissa0 << 32) | u.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; /* If the lower double is not a denomal or zero then set the hidden 53rd bit. */ - if (u.ieee.exponent2 > 0) + if (u.d[1].ieee.exponent > 0) { lo |= 1LL << 52; /* The lower double is normalized separately from the upper. We may need to adjust the lower manitissa to reflect this. */ - ediff = u.ieee.exponent - u.ieee.exponent2; + ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent; if (ediff > 53) lo = lo >> (ediff-53); } @@ -59,8 +59,8 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, difference between the long double and the rounded high double value. This is indicated by a differnce between the signs of the high and low doubles. */ - if ((u.ieee.negative != u.ieee.negative2) - && ((u.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 << 53) - lo; if (hi == 0LL) @@ -92,7 +92,7 @@ __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, #define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \ - (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB))) - if (u.ieee.exponent == 0) + if (u.d[0].ieee.exponent == 0) { /* A biased exponent of zero is a special case. Either it is a zero or it is a denormal number. */ |