aboutsummaryrefslogtreecommitdiff
path: root/gdb/doublest.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-08-01 18:39:27 +0000
committerAndrew Cagney <cagney@redhat.com>2001-08-01 18:39:27 +0000
commitd16aafd8c8fc6227dd015e45794817bd9ac2ea17 (patch)
treecbd7ea6cb8ab86e75b45a7059e2d6ecd7f991c03 /gdb/doublest.h
parent1b0cad1ced68bd444470091cb12b9208767895a4 (diff)
downloadgdb-d16aafd8c8fc6227dd015e45794817bd9ac2ea17.zip
gdb-d16aafd8c8fc6227dd015e45794817bd9ac2ea17.tar.gz
gdb-d16aafd8c8fc6227dd015e45794817bd9ac2ea17.tar.bz2
* defs.h (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT)
(HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT) (HOST_LONG_DOUBLE_FORMAT, DOUBLEST) (floatformat_to_doublest, floatformat_from_doublest) (floatformat_is_negative, floatformat_is_nan) (floatformat_mantissa, store_floating) (extract_floating): Move declaration from here. * doublest.h: To here. New file. * utils.c (get_field, floatformat_to_doublest, put_field) (ldfrexp, floatformat_from_doublest, floatformat_is_negative) (floatformat_is_nan, floatformat_mantissa) (FLOATFORMAT_CHAR_BIT): Move from here. * doublest.c: To here. New file. * findvar.c (store_floating, extract_floating): Move from here. * doublest.c: To here. * Makefile.in (SFILES): Add doublest.c. (COMMON_OBS): Add doublest.o. (doublest.o): Specify dependencies. (doublest_h): Define. * config/m88k/tm-m88k.h: Include "doublest.h". * config/i960/tm-i960.h: Ditto. * config/i386/tm-symmetry.h: Ditto. * rs6000-tdep.c, valarith.c: Ditto. * valprint.c, stabsread.c, sh-tdep.c: Ditto. * ia64-tdep.c, i387-tdep.c, i386-tdep.c: Ditto. * values.c, arm-tdep.c, arm-linux-tdep.c: Ditto. * alpha-tdep.c, ax.h, expression.h: Ditto. * sh-tdep.c, parse.c, top.c, value.h: Ditto. * Makefile.in (arm-tdep.o): Add $(doublest_h). (i386-tdep.o, i387-tdep.o, ia64-tdep.o): Ditto. (rs6000-tdep.o, stabsread.o, valarith.o): Ditto. (values.o, valprint.o, arm-linux-tdep.o): Ditto. (alpha-tdep.o, ax_h, parse.o, top.o, value_h): Ditto. (parser_defs_h): Ditto. (expression_h): Add $(doublest_h) and $(symtab_h).
Diffstat (limited to 'gdb/doublest.h')
-rw-r--r--gdb/doublest.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/gdb/doublest.h b/gdb/doublest.h
new file mode 100644
index 0000000..8e39196
--- /dev/null
+++ b/gdb/doublest.h
@@ -0,0 +1,87 @@
+/* Floating point definitions for GDB.
+ Copyright 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+ 1997, 1998, 1999, 2000, 2001
+ Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef DOUBLEST_H
+#define DOUBLEST_H
+
+/* Setup definitions for host and target floating point formats. We need to
+ consider the format for `float', `double', and `long double' for both target
+ and host. We need to do this so that we know what kind of conversions need
+ to be done when converting target numbers to and from the hosts DOUBLEST
+ data type. */
+
+/* This is used to indicate that we don't know the format of the floating point
+ number. Typically, this is useful for native ports, where the actual format
+ is irrelevant, since no conversions will be taking place. */
+
+#include "floatformat.h" /* For struct floatformat */
+
+extern const struct floatformat floatformat_unknown;
+
+#if HOST_BYTE_ORDER == BIG_ENDIAN
+#ifndef HOST_FLOAT_FORMAT
+#define HOST_FLOAT_FORMAT &floatformat_ieee_single_big
+#endif
+#ifndef HOST_DOUBLE_FORMAT
+#define HOST_DOUBLE_FORMAT &floatformat_ieee_double_big
+#endif
+#else /* LITTLE_ENDIAN */
+#ifndef HOST_FLOAT_FORMAT
+#define HOST_FLOAT_FORMAT &floatformat_ieee_single_little
+#endif
+#ifndef HOST_DOUBLE_FORMAT
+#define HOST_DOUBLE_FORMAT &floatformat_ieee_double_little
+#endif
+#endif
+
+#ifndef HOST_LONG_DOUBLE_FORMAT
+#define HOST_LONG_DOUBLE_FORMAT &floatformat_unknown
+#endif
+
+/* Use `long double' if the host compiler supports it. (Note that this is not
+ necessarily any longer than `double'. On SunOS/gcc, it's the same as
+ double.) This is necessary because GDB internally converts all floating
+ point values to the widest type supported by the host.
+
+ There are problems however, when the target `long double' is longer than the
+ host's `long double'. In general, we'll probably reduce the precision of
+ any such values and print a warning. */
+
+#ifdef HAVE_LONG_DOUBLE
+typedef long double DOUBLEST;
+#else
+typedef double DOUBLEST;
+#endif
+
+extern void floatformat_to_doublest (const struct floatformat *,
+ char *, DOUBLEST *);
+extern void floatformat_from_doublest (const struct floatformat *,
+ DOUBLEST *, char *);
+
+extern int floatformat_is_negative (const struct floatformat *, char *);
+extern int floatformat_is_nan (const struct floatformat *, char *);
+extern char *floatformat_mantissa (const struct floatformat *, char *);
+
+extern DOUBLEST extract_floating (void *, int);
+extern void store_floating (void *, int, DOUBLEST);
+
+#endif