aboutsummaryrefslogtreecommitdiff
path: root/gdb/doublest.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-05-18 13:43:35 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-05-18 13:43:35 +0000
commite035e3736f445850fa1372f8d2a7f403cf1cf6a7 (patch)
tree119a71eb84046a9fe4a6772a92331a541824b190 /gdb/doublest.c
parent487df32df7f09e694bc8f4bc9e5aa7f55c50eb58 (diff)
downloadgdb-e035e3736f445850fa1372f8d2a7f403cf1cf6a7.zip
gdb-e035e3736f445850fa1372f8d2a7f403cf1cf6a7.tar.gz
gdb-e035e3736f445850fa1372f8d2a7f403cf1cf6a7.tar.bz2
* doublest.c (NAN): Remove unused define.
(extract_floating_by_length, deprecated_extract_floating): Remove. (store_floating_by_length, deprecated_store_floating): Remove. (extract_typed_floating): Do not call extract_floating_by_length. (store_typed_floating): Do not call store_floating_by_length. (convert_typed_floating): Remove redundant assertions. * doublest.h (deprecated_extract_floating): Remove. (deprecated_store_floating): Remove. * sh64-tdep.c (sh64_register_convert_to_raw): Call extract_typed_floating instead of deprecated_extract_floating.
Diffstat (limited to 'gdb/doublest.c')
-rw-r--r--gdb/doublest.c67
1 files changed, 4 insertions, 63 deletions
diff --git a/gdb/doublest.c b/gdb/doublest.c
index 859b439..6a2ba8c 100644
--- a/gdb/doublest.c
+++ b/gdb/doublest.c
@@ -800,65 +800,16 @@ floatformat_from_type (const struct type *type)
return floatformat_from_length (TYPE_LENGTH (type));
}
-/* If the host doesn't define NAN, use zero instead. */
-#ifndef NAN
-#define NAN 0.0
-#endif
-
-/* Extract a floating-point number of length LEN from a target-order
- byte-stream at ADDR. Returns the value as type DOUBLEST. */
-
-static DOUBLEST
-extract_floating_by_length (const void *addr, int len)
-{
- const struct floatformat *fmt = floatformat_from_length (len);
- DOUBLEST val;
-
- floatformat_to_doublest (fmt, addr, &val);
- return val;
-}
-
-DOUBLEST
-deprecated_extract_floating (const void *addr, int len)
-{
- return extract_floating_by_length (addr, len);
-}
-
-/* Store VAL as a floating-point number of length LEN to a
- target-order byte-stream at ADDR. */
-
-static void
-store_floating_by_length (void *addr, int len, DOUBLEST val)
-{
- const struct floatformat *fmt = floatformat_from_length (len);
-
- floatformat_from_doublest (fmt, &val, addr);
-}
-
-void
-deprecated_store_floating (void *addr, int len, DOUBLEST val)
-{
- store_floating_by_length (addr, len, val);
-}
-
/* Extract a floating-point number of type TYPE from a target-order
byte-stream at ADDR. Returns the value as type DOUBLEST. */
DOUBLEST
extract_typed_floating (const void *addr, const struct type *type)
{
+ const struct floatformat *fmt = floatformat_from_type (type);
DOUBLEST retval;
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
-
- if (TYPE_FLOATFORMAT (type) == NULL)
- /* Not all code remembers to set the FLOATFORMAT (language
- specific code? stabs?) so handle that here as a special case. */
- return extract_floating_by_length (addr, TYPE_LENGTH (type));
-
- floatformat_to_doublest
- (TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)],
- addr, &retval);
+ floatformat_to_doublest (fmt, addr, &retval);
return retval;
}
@@ -868,7 +819,7 @@ extract_typed_floating (const void *addr, const struct type *type)
void
store_typed_floating (void *addr, const struct type *type, DOUBLEST val)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
+ const struct floatformat *fmt = floatformat_from_type (type);
/* FIXME: kettenis/2001-10-28: It is debatable whether we should
zero out any remaining bytes in the target buffer when TYPE is
@@ -890,14 +841,7 @@ store_typed_floating (void *addr, const struct type *type, DOUBLEST val)
See also the function convert_typed_floating below. */
memset (addr, 0, TYPE_LENGTH (type));
- if (TYPE_FLOATFORMAT (type) == NULL)
- /* Not all code remembers to set the FLOATFORMAT (language
- specific code? stabs?) so handle that here as a special case. */
- store_floating_by_length (addr, TYPE_LENGTH (type), val);
- else
- floatformat_from_doublest
- (TYPE_FLOATFORMAT (type)[gdbarch_byte_order (current_gdbarch)],
- &val, addr);
+ floatformat_from_doublest (fmt, &val, addr);
}
/* Convert a floating-point number of type FROM_TYPE from a
@@ -911,9 +855,6 @@ convert_typed_floating (const void *from, const struct type *from_type,
const struct floatformat *from_fmt = floatformat_from_type (from_type);
const struct floatformat *to_fmt = floatformat_from_type (to_type);
- gdb_assert (TYPE_CODE (from_type) == TYPE_CODE_FLT);
- gdb_assert (TYPE_CODE (to_type) == TYPE_CODE_FLT);
-
if (from_fmt == NULL || to_fmt == NULL)
{
/* If we don't know the floating-point format of FROM_TYPE or