source: branches/libc-0.6/src/emx/include/floatformat.h

Last change on this file was 1506, checked in by bird, 21 years ago

@unixroot. header reviews. ++

  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.3 KB
Line 
1/* floatformat.h,v 1.2 2004/09/14 22:27:33 bird Exp */
2/** @file
3 * GNU, -liberty.
4 */
5
6/* IEEE floating point support declarations, for GDB, the GNU Debugger.
7 Copyright 1991, 1994, 1995, 1997, 2000 Free Software Foundation, Inc.
8
9This file is part of GDB.
10
11This program is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 2 of the License, or
14(at your option) any later version.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with this program; if not, write to the Free Software
23Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
24
25#if !defined (FLOATFORMAT_H)
26#define FLOATFORMAT_H 1
27
28#include "ansidecl.h"
29
30/* A floatformat consists of a sign bit, an exponent and a mantissa. Once the
31 bytes are concatenated according to the byteorder flag, then each of those
32 fields is contiguous. We number the bits with 0 being the most significant
33 (i.e. BITS_BIG_ENDIAN type numbering), and specify which bits each field
34 contains with the *_start and *_len fields. */
35
36/* What is the order of the bytes. */
37
38enum floatformat_byteorders {
39
40 /* Standard little endian byte order.
41 EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */
42
43 floatformat_little,
44
45 /* Standard big endian byte order.
46 EX: 1.2345678e10 => 42 06 fe e0 c5 80 00 00 */
47
48 floatformat_big,
49
50 /* Little endian byte order but big endian word order.
51 EX: 1.2345678e10 => e0 fe 06 42 00 00 80 c5 */
52
53 floatformat_littlebyte_bigword
54
55};
56
57enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no };
58
59struct 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 /* Amount added to "true" exponent. 0x3fff for many IEEE extendeds. */
70 unsigned int exp_bias;
71 /* Exponent value which indicates NaN. This is the actual value stored in
72 the float, not adjusted by the exp_bias. This usually consists of all
73 one bits. */
74 unsigned int exp_nan;
75
76 unsigned int man_start;
77 unsigned int man_len;
78
79 /* Is the integer bit explicit or implicit? */
80 enum floatformat_intbit intbit;
81
82 /* Internal name for debugging. */
83 const char *name;
84};
85
86/* floatformats for IEEE single and double, big and little endian. */
87
88extern const struct floatformat floatformat_ieee_single_big;
89extern const struct floatformat floatformat_ieee_single_little;
90extern const struct floatformat floatformat_ieee_double_big;
91extern const struct floatformat floatformat_ieee_double_little;
92
93/* floatformat for ARM IEEE double, little endian bytes and big endian words */
94
95extern const struct floatformat floatformat_ieee_double_littlebyte_bigword;
96
97/* floatformats for various extendeds. */
98
99extern const struct floatformat floatformat_i387_ext;
100extern const struct floatformat floatformat_m68881_ext;
101extern const struct floatformat floatformat_i960_ext;
102extern const struct floatformat floatformat_m88110_ext;
103extern const struct floatformat floatformat_m88110_harris_ext;
104extern const struct floatformat floatformat_arm_ext; /* deprecated. */
105extern const struct floatformat floatformat_arm_ext_big;
106extern const struct floatformat floatformat_arm_ext_littlebyte_bigword;
107/* IA-64 Floating Point register spilt into memory. */
108extern const struct floatformat floatformat_ia64_spill_big;
109extern const struct floatformat floatformat_ia64_spill_little;
110extern const struct floatformat floatformat_ia64_quad_big;
111extern const struct floatformat floatformat_ia64_quad_little;
112
113/* Convert from FMT to a double.
114 FROM is the address of the extended float.
115 Store the double in *TO. */
116
117extern void
118floatformat_to_double PARAMS ((const struct floatformat *, char *, double *));
119
120/* The converse: convert the double *FROM to FMT
121 and store where TO points. */
122
123extern void
124floatformat_from_double PARAMS ((const struct floatformat *,
125 double *, char *));
126
127#endif /* defined (FLOATFORMAT_H) */
Note: See TracBrowser for help on using the repository browser.