From f0d4cc9e0ec5ad1533782d32bbf5029b2601828f Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 2 Jun 2000 01:59:13 +0000 Subject: Multiarch TARGET_FLOAT_FORMAT, TARGET_DOUBLE_FORMAT, TARGET_LONG_DOUBLE_FORMAT. Update d10v. --- gdb/arch-utils.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'gdb/arch-utils.c') diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index a012b42..be2433d 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -41,6 +41,8 @@ #include "symfile.h" /* for overlay functions */ #endif +#include "floatformat.h" + /* Convenience macro for allocting typesafe memory. */ #ifndef XMALLOC @@ -163,6 +165,47 @@ core_addr_greaterthan (lhs, rhs) } +/* Helper functions for TARGET_{FLOAT,DOUBLE}_FORMAT */ + +const struct floatformat * +default_float_format (struct gdbarch *gdbarch) +{ +#if GDB_MULTI_ARCH + int byte_order = gdbarch_byte_order (gdbarch); +#else + int byte_order = TARGET_BYTE_ORDER; +#endif + switch (byte_order) + { + case BIG_ENDIAN: + return &floatformat_ieee_single_big; + case LITTLE_ENDIAN: + return &floatformat_ieee_single_little; + default: + internal_error ("default_float_format: bad byte order"); + } +} + + +const struct floatformat * +default_double_format (struct gdbarch *gdbarch) +{ +#if GDB_MULTI_ARCH + int byte_order = gdbarch_byte_order (gdbarch); +#else + int byte_order = TARGET_BYTE_ORDER; +#endif + switch (byte_order) + { + case BIG_ENDIAN: + return &floatformat_ieee_double_big; + case LITTLE_ENDIAN: + return &floatformat_ieee_double_little; + default: + internal_error ("default_double_format: bad byte order"); + } +} + /* */ extern initialize_file_ftype __initialize_gdbarch_utils; -- cgit v1.1