* config/tc-xtensa.c (xtensa_move_labels): Remove loops_ok argument.
[deliverable/binutils-gdb.git] / gdb / doublest.h
CommitLineData
d16aafd8 1/* Floating point definitions for GDB.
f1908289 2
6aba47ca
DJ
3 Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
4 1997, 1998, 1999, 2000, 2001, 2003, 2005, 2006, 2007
48426bc2 5 Free Software Foundation, Inc.
d16aafd8
AC
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
197e01b6
EZ
21 Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 Boston, MA 02110-1301, USA. */
d16aafd8
AC
23
24#ifndef DOUBLEST_H
25#define DOUBLEST_H
26
da3331ec 27struct type;
5ef2d0aa 28struct floatformat;
da3331ec 29
d16aafd8
AC
30/* Setup definitions for host and target floating point formats. We need to
31 consider the format for `float', `double', and `long double' for both target
32 and host. We need to do this so that we know what kind of conversions need
33 to be done when converting target numbers to and from the hosts DOUBLEST
34 data type. */
35
36/* This is used to indicate that we don't know the format of the floating point
37 number. Typically, this is useful for native ports, where the actual format
38 is irrelevant, since no conversions will be taking place. */
39
40#include "floatformat.h" /* For struct floatformat */
41
d16aafd8
AC
42/* Use `long double' if the host compiler supports it. (Note that this is not
43 necessarily any longer than `double'. On SunOS/gcc, it's the same as
44 double.) This is necessary because GDB internally converts all floating
45 point values to the widest type supported by the host.
46
47 There are problems however, when the target `long double' is longer than the
48 host's `long double'. In general, we'll probably reduce the precision of
49 any such values and print a warning. */
50
a6205f53
DJ
51#if (defined HAVE_LONG_DOUBLE && defined PRINTF_HAS_LONG_DOUBLE \
52 && defined SCANF_HAS_LONG_DOUBLE)
d16aafd8 53typedef long double DOUBLEST;
a6205f53
DJ
54# define DOUBLEST_PRINT_FORMAT "%Lg"
55# define DOUBLEST_SCAN_FORMAT "%Lg"
d16aafd8
AC
56#else
57typedef double DOUBLEST;
a6205f53
DJ
58# define DOUBLEST_PRINT_FORMAT "%g"
59# define DOUBLEST_SCAN_FORMAT "%lg"
96c1eda2
AO
60/* If we can't scan or print long double, we don't want to use it
61 anywhere. */
62# undef HAVE_LONG_DOUBLE
a6205f53
DJ
63# undef PRINTF_HAS_LONG_DOUBLE
64# undef SCANF_HAS_LONG_DOUBLE
d16aafd8
AC
65#endif
66
20389057
DJ
67/* Different kinds of floatformat numbers recognized by
68 floatformat_classify. To avoid portability issues, we use local
69 values instead of the C99 macros (FP_NAN et cetera). */
70enum float_kind {
71 float_nan,
72 float_infinite,
73 float_zero,
74 float_normal,
75 float_subnormal
76};
77
d16aafd8 78extern void floatformat_to_doublest (const struct floatformat *,
64f6fcad 79 const void *in, DOUBLEST *out);
d16aafd8 80extern void floatformat_from_doublest (const struct floatformat *,
64f6fcad 81 const DOUBLEST *in, void *out);
d16aafd8 82
108d6ead
AC
83extern int floatformat_is_negative (const struct floatformat *,
84 const bfd_byte *);
20389057
DJ
85extern enum float_kind floatformat_classify (const struct floatformat *,
86 const bfd_byte *);
108d6ead
AC
87extern const char *floatformat_mantissa (const struct floatformat *,
88 const bfd_byte *);
d16aafd8 89
f1908289
AC
90/* These functions have been replaced by extract_typed_floating and
91 store_typed_floating.
92
93 Most calls are passing in TYPE_LENGTH (TYPE) so can be changed to
94 just pass the TYPE. The remainder pass in the length of a
95 register, those calls should instead pass in the floating point
96 type that corresponds to that length. */
87ffba60 97
f1908289
AC
98extern DOUBLEST deprecated_extract_floating (const void *addr, int len);
99extern void deprecated_store_floating (void *addr, int len, DOUBLEST val);
96d2f608 100
c2f05ac9
AC
101/* Given TYPE, return its floatformat. TYPE_FLOATFORMAT() may return
102 NULL. type_floatformat() detects that and returns a floatformat
103 based on the type size when FLOATFORMAT is NULL. */
104
105const struct floatformat *floatformat_from_type (const struct type *type);
106
96d2f608
AC
107extern DOUBLEST extract_typed_floating (const void *addr,
108 const struct type *type);
109extern void store_typed_floating (void *addr, const struct type *type,
110 DOUBLEST val);
43686d64
MK
111extern void convert_typed_floating (const void *from,
112 const struct type *from_type,
113 void *to, const struct type *to_type);
d16aafd8
AC
114
115#endif
This page took 0.407025 seconds and 4 git commands to generate.