diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-01-20 18:05:54 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-01-20 18:05:54 +0000 |
commit | c2f05ac92e7fe9e3161ae09ea3f9e0937af42abc (patch) | |
tree | 766a0ffadb76b1de1e4fe885959760c3e720b962 /gdb/doublest.c | |
parent | 56248298dc57e763e4e8afbd90926bc19e25b3ac (diff) | |
download | gdb-c2f05ac92e7fe9e3161ae09ea3f9e0937af42abc.zip gdb-c2f05ac92e7fe9e3161ae09ea3f9e0937af42abc.tar.gz gdb-c2f05ac92e7fe9e3161ae09ea3f9e0937af42abc.tar.bz2 |
Eliminate IEEE_FLOAT.
Diffstat (limited to 'gdb/doublest.c')
-rw-r--r-- | gdb/doublest.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gdb/doublest.c b/gdb/doublest.c index 083a50a..2b60657 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -619,7 +619,7 @@ floatformat_from_doublest (const struct floatformat *fmt, target-dependent code, the format of floating-point types is known, but not passed on by GDB. This should be fixed. */ -static const struct floatformat * +const struct floatformat * floatformat_from_length (int len) { if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT) @@ -632,6 +632,16 @@ floatformat_from_length (int len) return NULL; } +const struct floatformat * +floatformat_from_type (const struct type *type) +{ + gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT); + if (TYPE_FLOATFORMAT (type) != NULL) + return TYPE_FLOATFORMAT (type); + else + return floatformat_from_length (TYPE_LENGTH (type)); +} + /* If the host doesn't define NAN, use zero instead. */ #ifndef NAN #define NAN 0.0 @@ -732,19 +742,12 @@ void convert_typed_floating (const void *from, const struct type *from_type, void *to, const struct type *to_type) { - const struct floatformat *from_fmt = TYPE_FLOATFORMAT (from_type); - const struct floatformat *to_fmt = TYPE_FLOATFORMAT (to_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 the floating-point format of FROM_TYPE or TO_TYPE isn't known, - try to guess it from the type's length. */ - if (from_fmt == NULL) - from_fmt = floatformat_from_length (TYPE_LENGTH (from_type)); - if (to_fmt == NULL) - to_fmt = floatformat_from_length (TYPE_LENGTH (to_type)); - if (from_fmt == NULL || to_fmt == NULL) { /* If we don't know the floating-point format of FROM_TYPE or |