aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Newton <willnewton@sourceware.org>2013-06-21 16:24:14 +0000
committerWill Newton <willnewton@sourceware.org>2013-06-21 16:24:14 +0000
commit85d3b769fc320dbcaa90362b631887198389e635 (patch)
treed5302dc8880d2d2088d573cf23f2cb326890d049
parent88b48903525b1683e1c00ad10cf4bc0be6718f5d (diff)
downloadgdb-85d3b769fc320dbcaa90362b631887198389e635.zip
gdb-85d3b769fc320dbcaa90362b631887198389e635.tar.gz
gdb-85d3b769fc320dbcaa90362b631887198389e635.tar.bz2
gdb/doublest.c: Use frexpl rather than ldfrexp.
Most modern systems have frexpl and gnulib provides an implementation for those that don't, so use it instead of the generic but inaccurate ldfrexp. gdb/ChangeLog: 2013-06-21 Will Newton <will.newton@linaro.org> * doublest.c (ldfrexp): Remove function. (convert_doublest_to_floatformat): Call frexpl instead of ldfrexp.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/doublest.c49
2 files changed, 7 insertions, 48 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a997577..dc234f4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2013-06-21 Will Newton <will.newton@linaro.org>
+ * doublest.c (ldfrexp): Remove function.
+ (convert_doublest_to_floatformat): Call frexpl instead of
+ ldfrexp.
+
+2013-06-21 Will Newton <will.newton@linaro.org>
+
* gnulib/update-gnulib.sh(IMPORTED_GNULIB_MODULES): Add frexpl.
* gnulib/aclocal.m4: Regenerate.
* gnulib/config.in: Regenerate.
diff --git a/gdb/doublest.c b/gdb/doublest.c
index 9ddc7a6..2e4c87e 100644
--- a/gdb/doublest.c
+++ b/gdb/doublest.c
@@ -336,53 +336,6 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
}
}
-#ifdef HAVE_LONG_DOUBLE
-/* Return the fractional part of VALUE, and put the exponent of VALUE in *EPTR.
- The range of the returned value is >= 0.5 and < 1.0. This is equivalent to
- frexp, but operates on the long double data type. */
-
-static long double ldfrexp (long double value, int *eptr);
-
-static long double
-ldfrexp (long double value, int *eptr)
-{
- long double tmp;
- int exp;
-
- /* Unfortunately, there are no portable functions for extracting the
- exponent of a long double, so we have to do it iteratively by
- multiplying or dividing by two until the fraction is between 0.5
- and 1.0. */
-
- if (value < 0.0l)
- value = -value;
-
- tmp = 1.0l;
- exp = 0;
-
- if (value >= tmp) /* Value >= 1.0 */
- while (value >= tmp)
- {
- tmp *= 2.0l;
- exp++;
- }
- else if (value != 0.0l) /* Value < 1.0 and > 0.0 */
- {
- while (value < tmp)
- {
- tmp /= 2.0l;
- exp--;
- }
- tmp *= 2.0l;
- exp++;
- }
-
- *eptr = exp;
- return value / tmp;
-}
-#endif /* HAVE_LONG_DOUBLE */
-
-
/* The converse: convert the DOUBLEST *FROM to an extended float and
store where TO points. Neither FROM nor TO have any alignment
restrictions. */
@@ -466,7 +419,7 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt,
}
#ifdef HAVE_LONG_DOUBLE
- mant = ldfrexp (dfrom, &exponent);
+ mant = frexpl (dfrom, &exponent);
#else
mant = frexp (dfrom, &exponent);
#endif