OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [doublest.h] - Blame information for rev 363

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
/* Floating point definitions for GDB.
2
 
3
   Copyright (C) 1986, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
4
   1997, 1998, 1999, 2000, 2001, 2003, 2005, 2006, 2007, 2008
5
   Free Software Foundation, Inc.
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 3 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, see <http://www.gnu.org/licenses/>.  */
21
 
22
#ifndef DOUBLEST_H
23
#define DOUBLEST_H
24
 
25
struct type;
26
struct floatformat;
27
 
28
/* Setup definitions for host and target floating point formats.  We need to
29
   consider the format for `float', `double', and `long double' for both target
30
   and host.  We need to do this so that we know what kind of conversions need
31
   to be done when converting target numbers to and from the hosts DOUBLEST
32
   data type.  */
33
 
34
/* This is used to indicate that we don't know the format of the floating point
35
   number.  Typically, this is useful for native ports, where the actual format
36
   is irrelevant, since no conversions will be taking place.  */
37
 
38
#include "floatformat.h"        /* For struct floatformat */
39
 
40
/* Use `long double' if the host compiler supports it.  (Note that this is not
41
   necessarily any longer than `double'.  On SunOS/gcc, it's the same as
42
   double.)  This is necessary because GDB internally converts all floating
43
   point values to the widest type supported by the host.
44
 
45
   There are problems however, when the target `long double' is longer than the
46
   host's `long double'.  In general, we'll probably reduce the precision of
47
   any such values and print a warning.  */
48
 
49
#if (defined HAVE_LONG_DOUBLE && defined PRINTF_HAS_LONG_DOUBLE \
50
     && defined SCANF_HAS_LONG_DOUBLE)
51
typedef long double DOUBLEST;
52
# define DOUBLEST_PRINT_FORMAT "Lg"
53
# define DOUBLEST_SCAN_FORMAT "Lg"
54
#else
55
typedef double DOUBLEST;
56
# define DOUBLEST_PRINT_FORMAT "g"
57
# define DOUBLEST_SCAN_FORMAT "lg"
58
/* If we can't scan or print long double, we don't want to use it
59
   anywhere.  */
60
# undef HAVE_LONG_DOUBLE
61
# undef PRINTF_HAS_LONG_DOUBLE
62
# undef SCANF_HAS_LONG_DOUBLE
63
#endif
64
 
65
/* Different kinds of floatformat numbers recognized by
66
   floatformat_classify.  To avoid portability issues, we use local
67
   values instead of the C99 macros (FP_NAN et cetera).  */
68
enum float_kind {
69
  float_nan,
70
  float_infinite,
71
  float_zero,
72
  float_normal,
73
  float_subnormal
74
};
75
 
76
extern void floatformat_to_doublest (const struct floatformat *,
77
                                     const void *in, DOUBLEST *out);
78
extern void floatformat_from_doublest (const struct floatformat *,
79
                                       const DOUBLEST *in, void *out);
80
 
81
extern int floatformat_is_negative (const struct floatformat *,
82
                                    const bfd_byte *);
83
extern enum float_kind floatformat_classify (const struct floatformat *,
84
                                             const bfd_byte *);
85
extern const char *floatformat_mantissa (const struct floatformat *,
86
                                         const bfd_byte *);
87
 
88
/* These functions have been replaced by extract_typed_floating and
89
   store_typed_floating.
90
 
91
   Most calls are passing in TYPE_LENGTH (TYPE) so can be changed to
92
   just pass the TYPE.  The remainder pass in the length of a
93
   register, those calls should instead pass in the floating point
94
   type that corresponds to that length.  */
95
 
96
extern DOUBLEST deprecated_extract_floating (const void *addr, int len);
97
extern void deprecated_store_floating (void *addr, int len, DOUBLEST val);
98
 
99
/* Given TYPE, return its floatformat.  TYPE_FLOATFORMAT() may return
100
   NULL.  type_floatformat() detects that and returns a floatformat
101
   based on the type size when FLOATFORMAT is NULL.  */
102
 
103
const struct floatformat *floatformat_from_type (const struct type *type);
104
 
105
extern DOUBLEST extract_typed_floating (const void *addr,
106
                                        const struct type *type);
107
extern void store_typed_floating (void *addr, const struct type *type,
108
                                  DOUBLEST val);
109
extern void convert_typed_floating (const void *from,
110
                                    const struct type *from_type,
111
                                    void *to, const struct type *to_type);
112
 
113
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.