]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/language/c/libm/v2_0/include/sys/ieeefp.h
Initial revision
[karo-tx-redboot.git] / packages / language / c / libm / v2_0 / include / sys / ieeefp.h
1 #ifndef CYGONCE_LIBM_SYS_IEEEFP_H
2 #define CYGONCE_LIBM_SYS_IEEEFP_H
3 //===========================================================================
4 //
5 //      ieeefp.h
6 //
7 //      Definitions specific to IEEE-754 floating-point format
8 //
9 //===========================================================================
10 //####ECOSGPLCOPYRIGHTBEGIN####
11 // -------------------------------------------
12 // This file is part of eCos, the Embedded Configurable Operating System.
13 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14 //
15 // eCos is free software; you can redistribute it and/or modify it under
16 // the terms of the GNU General Public License as published by the Free
17 // Software Foundation; either version 2 or (at your option) any later version.
18 //
19 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22 // for more details.
23 //
24 // You should have received a copy of the GNU General Public License along
25 // with eCos; if not, write to the Free Software Foundation, Inc.,
26 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 //
28 // As a special exception, if other files instantiate templates or use macros
29 // or inline functions from this file, or you compile this file and link it
30 // with other works to produce a work based on this file, this file does not
31 // by itself cause the resulting work to be covered by the GNU General Public
32 // License. However the source code for this file must still be made available
33 // in accordance with section (3) of the GNU General Public License.
34 //
35 // This exception does not invalidate any other reasons why a work based on
36 // this file might be covered by the GNU General Public License.
37 //
38 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39 // at http://sources.redhat.com/ecos/ecos-license/
40 // -------------------------------------------
41 //####ECOSGPLCOPYRIGHTEND####
42 //===========================================================================
43 //#####DESCRIPTIONBEGIN####
44 //
45 // Author(s):   jlarmour
46 // Contributors:  jlarmour
47 // Date:        1998-02-13
48 // Purpose:     
49 // Description: Definitions specific to IEEE-754 floating-point format
50 // Usage:       #include <sys/ieeefp.h>
51 //
52 //####DESCRIPTIONEND####
53 //
54 //===========================================================================
55
56 // CONFIGURATION
57
58 #include <pkgconf/libm.h>   // Configuration header
59
60 // Include the Math library?
61 #ifdef CYGPKG_LIBM     
62
63 // INCLUDES
64
65 #include <cyg/infra/cyg_type.h>     // Common type definitions and support
66                                     // including endian-ness
67
68 #if (CYG_BYTEORDER == CYG_MSBFIRST) // Big endian
69
70 // Note: there do not seem to be any current machines which are Big Endian but
71 // have a mixed up double layout. 
72
73 typedef union 
74 {
75     cyg_int32 asi32[2];
76
77     cyg_int64 asi64;
78     
79     double value;
80     
81     struct 
82     {
83         unsigned int sign : 1;
84         unsigned int exponent: 11;
85         unsigned int fraction0:4;
86         unsigned int fraction1:16;
87         unsigned int fraction2:16;
88         unsigned int fraction3:16;
89         
90     } number;
91     
92     struct 
93     {
94         unsigned int sign : 1;
95         unsigned int exponent: 11;
96         unsigned int quiet:1;
97         unsigned int function0:3;
98         unsigned int function1:16;
99         unsigned int function2:16;
100         unsigned int function3:16;
101     } nan;
102     
103     struct 
104     {
105         cyg_uint32 msw;
106         cyg_uint32 lsw;
107     } parts;
108
109     
110 } Cyg_libm_ieee_double_shape_type;
111
112
113 typedef union
114 {
115     cyg_int32 asi32;
116     
117     float value;
118
119     struct 
120     {
121         unsigned int sign : 1;
122         unsigned int exponent: 8;
123         unsigned int fraction0: 7;
124         unsigned int fraction1: 16;
125     } number;
126
127     struct 
128     {
129         unsigned int sign:1;
130         unsigned int exponent:8;
131         unsigned int quiet:1;
132         unsigned int function0:6;
133         unsigned int function1:16;
134     } nan;
135     
136 } Cyg_libm_ieee_float_shape_type;
137
138
139 #else // Little endian
140
141 typedef union 
142 {
143     cyg_int32 asi32[2];
144
145     cyg_int64 asi64;
146     
147     double value;
148
149     struct 
150     {
151 #if (CYG_DOUBLE_BYTEORDER == CYG_MSBFIRST) // Big endian
152         unsigned int fraction1:16;
153         unsigned int fraction0: 4;
154         unsigned int exponent :11;
155         unsigned int sign     : 1;
156         unsigned int fraction3:16;
157         unsigned int fraction2:16;
158 #else
159         unsigned int fraction3:16;
160         unsigned int fraction2:16;
161         unsigned int fraction1:16;
162         unsigned int fraction0: 4;
163         unsigned int exponent :11;
164         unsigned int sign     : 1;
165 #endif
166     } number;
167
168     struct 
169     {
170 #if (CYG_DOUBLE_BYTEORDER == CYG_MSBFIRST) // Big endian
171         unsigned int function1:16;
172         unsigned int function0:3;
173         unsigned int quiet:1;
174         unsigned int exponent: 11;
175         unsigned int sign : 1;
176         unsigned int function3:16;
177         unsigned int function2:16;
178 #else
179         unsigned int function3:16;
180         unsigned int function2:16;
181         unsigned int function1:16;
182         unsigned int function0:3;
183         unsigned int quiet:1;
184         unsigned int exponent: 11;
185         unsigned int sign : 1;
186 #endif
187     } nan;
188
189     struct 
190     {
191 #if (CYG_DOUBLE_BYTEORDER == CYG_MSBFIRST) // Big endian
192         cyg_uint32 msw;
193         cyg_uint32 lsw;
194 #else
195         cyg_uint32 lsw;
196         cyg_uint32 msw;
197 #endif
198     } parts;
199     
200 } Cyg_libm_ieee_double_shape_type;
201
202
203 typedef union
204 {
205     cyg_int32 asi32;
206   
207     float value;
208
209     struct 
210     {
211         unsigned int fraction0: 7;
212         unsigned int fraction1: 16;
213         unsigned int exponent: 8;
214         unsigned int sign : 1;
215     } number;
216
217     struct 
218     {
219         unsigned int function1:16;
220         unsigned int function0:6;
221         unsigned int quiet:1;
222         unsigned int exponent:8;
223         unsigned int sign:1;
224     } nan;
225
226 } Cyg_libm_ieee_float_shape_type;
227
228 #endif // little-endian
229
230
231 #endif // ifdef CYGPKG_LIBM     
232
233 #endif // CYGONCE_LIBM_SYS_IEEEFP_H multiple inclusion protection
234
235 // EOF ieeefp.h