Mercurial > hg > CbC > CbC_gcc
annotate include/floatformat.h @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 1830386684a0 |
children |
rev | line source |
---|---|
0 | 1 /* IEEE floating point support declarations, for GDB, the GNU Debugger. |
145 | 2 Copyright (C) 1991-2020 Free Software Foundation, Inc. |
0 | 3 |
4 This file is part of GDB. | |
5 | |
6 This program is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2 of the License, or | |
9 (at your option) any later version. | |
10 | |
11 This program is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with this program; if not, write to the Free Software | |
18 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ | |
19 | |
20 #if !defined (FLOATFORMAT_H) | |
21 #define FLOATFORMAT_H 1 | |
22 | |
23 #include "ansidecl.h" | |
24 | |
111 | 25 #ifdef __cplusplus |
26 extern "C" { | |
27 #endif | |
28 | |
0 | 29 /* A floatformat consists of a sign bit, an exponent and a mantissa. Once the |
30 bytes are concatenated according to the byteorder flag, then each of those | |
31 fields is contiguous. We number the bits with 0 being the most significant | |
32 (i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field | |
33 contains with the *_start and *_len fields. */ | |
34 | |
35 /* What is the order of the bytes? */ | |
36 | |
37 enum floatformat_byteorders { | |
38 /* Standard little endian byte order. | |
39 EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */ | |
40 floatformat_little, | |
41 | |
42 /* Standard big endian byte order. | |
43 EX: 1.2345678e10 => 42 06 fe e0 c5 80 00 00 */ | |
44 floatformat_big, | |
45 | |
46 /* Little endian byte order but big endian word order. | |
47 EX: 1.2345678e10 => e0 fe 06 42 00 00 80 c5 */ | |
48 floatformat_littlebyte_bigword, | |
49 | |
50 /* VAX byte order. Little endian byte order with 16-bit words. The | |
51 following example is an illustration of the byte order only; VAX | |
52 doesn't have a fully IEEE compliant floating-point format. | |
53 EX: 1.2345678e10 => 80 c5 00 00 06 42 e0 fe */ | |
54 floatformat_vax | |
55 }; | |
56 | |
57 enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no }; | |
58 | |
59 struct floatformat | |
60 { | |
61 enum floatformat_byteorders byteorder; | |
62 unsigned int totalsize; /* Total size of number in bits */ | |
63 | |
64 /* Sign bit is always one bit long. 1 means negative, 0 means positive. */ | |
65 unsigned int sign_start; | |
66 | |
67 unsigned int exp_start; | |
68 unsigned int exp_len; | |
69 /* Bias added to a "true" exponent to form the biased exponent. It | |
70 is intentionally signed as, otherwize, -exp_bias can turn into a | |
71 very large number (e.g., given the exp_bias of 0x3fff and a 64 | |
72 bit long, the equation (long)(1 - exp_bias) evaluates to | |
73 4294950914) instead of -16382). */ | |
74 int exp_bias; | |
75 /* Exponent value which indicates NaN. This is the actual value stored in | |
76 the float, not adjusted by the exp_bias. This usually consists of all | |
77 one bits. */ | |
78 unsigned int exp_nan; | |
79 | |
80 unsigned int man_start; | |
81 unsigned int man_len; | |
82 | |
83 /* Is the integer bit explicit or implicit? */ | |
84 enum floatformat_intbit intbit; | |
85 | |
86 /* Internal name for debugging. */ | |
87 const char *name; | |
88 | |
89 /* Validator method. */ | |
90 int (*is_valid) (const struct floatformat *fmt, const void *from); | |
91 | |
92 /* Is the format actually the sum of two smaller floating point | |
93 formats (IBM long double, as described in | |
94 gcc/config/rs6000/darwin-ldouble-format)? If so, this is the | |
95 smaller format in question, and the fields sign_start through | |
96 intbit describe the first half. If not, this is NULL. */ | |
97 const struct floatformat *split_half; | |
98 }; | |
99 | |
100 /* floatformats for IEEE single and double, big and little endian. */ | |
101 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
102 extern const struct floatformat floatformat_ieee_half_big; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
103 extern const struct floatformat floatformat_ieee_half_little; |
0 | 104 extern const struct floatformat floatformat_ieee_single_big; |
105 extern const struct floatformat floatformat_ieee_single_little; | |
106 extern const struct floatformat floatformat_ieee_double_big; | |
107 extern const struct floatformat floatformat_ieee_double_little; | |
108 | |
109 /* floatformat for ARM IEEE double, little endian bytes and big endian words */ | |
110 | |
111 extern const struct floatformat floatformat_ieee_double_littlebyte_bigword; | |
112 | |
113 /* floatformats for VAX. */ | |
114 | |
115 extern const struct floatformat floatformat_vax_f; | |
116 extern const struct floatformat floatformat_vax_d; | |
117 extern const struct floatformat floatformat_vax_g; | |
118 | |
119 /* floatformats for various extendeds. */ | |
120 | |
121 extern const struct floatformat floatformat_i387_ext; | |
122 extern const struct floatformat floatformat_m68881_ext; | |
123 extern const struct floatformat floatformat_i960_ext; | |
124 extern const struct floatformat floatformat_m88110_ext; | |
125 extern const struct floatformat floatformat_m88110_harris_ext; | |
126 extern const struct floatformat floatformat_arm_ext_big; | |
127 extern const struct floatformat floatformat_arm_ext_littlebyte_bigword; | |
128 /* IA-64 Floating Point register spilt into memory. */ | |
129 extern const struct floatformat floatformat_ia64_spill_big; | |
130 extern const struct floatformat floatformat_ia64_spill_little; | |
131 extern const struct floatformat floatformat_ia64_quad_big; | |
132 extern const struct floatformat floatformat_ia64_quad_little; | |
133 /* IBM long double (double+double). */ | |
111 | 134 extern const struct floatformat floatformat_ibm_long_double_big; |
135 extern const struct floatformat floatformat_ibm_long_double_little; | |
0 | 136 |
137 /* Convert from FMT to a double. | |
138 FROM is the address of the extended float. | |
139 Store the double in *TO. */ | |
140 | |
141 extern void | |
142 floatformat_to_double (const struct floatformat *, const void *, double *); | |
143 | |
144 /* The converse: convert the double *FROM to FMT | |
145 and store where TO points. */ | |
146 | |
147 extern void | |
148 floatformat_from_double (const struct floatformat *, const double *, void *); | |
149 | |
150 /* Return non-zero iff the data at FROM is a valid number in format FMT. */ | |
151 | |
152 extern int | |
153 floatformat_is_valid (const struct floatformat *fmt, const void *from); | |
154 | |
111 | 155 #ifdef __cplusplus |
156 } | |
157 #endif | |
158 | |
0 | 159 #endif /* defined (FLOATFORMAT_H) */ |