Subversion Repositories HelenOS-historic

Rev

Rev 535 | Rev 563 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 535 Rev 542
1
/*
1
/*
2
 * Copyright (C) 2005 Josef Cejka
2
 * Copyright (C) 2005 Josef Cejka
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
#ifndef __SOFTFLOAT_H__
29
#ifndef __SOFTFLOAT_H__
30
#define __SOFTFLOAT_H__
30
#define __SOFTFLOAT_H__
31
 
31
 
32
 
32
 
33
typedef union {
33
typedef union {
34
    float f;
34
    float f;
35
    struct  {
35
    struct  {
36
        #ifdef __BIG_ENDIAN__
36
        #ifdef __BIG_ENDIAN__
37
        __u8 sign:1;
37
        __u8 sign:1;
38
        __u8 exp:8;
38
        __u8 exp:8;
39
        __u32 mantisa:23;
39
        __u32 mantisa:23;
40
        #else
40
        #else
41
        #ifdef __LITTLE_ENDIAN__
41
        #ifdef __LITTLE_ENDIAN__
42
        __u32 mantisa:23;
42
        __u32 mantisa:23;
43
        __u8 exp:8;
43
        __u8 exp:8;
44
        __u8    sign:1;
44
        __u8 sign:1;
45
        #else 
45
        #else 
46
        #endif
46
        #endif
47
        } parts __attribute__ ((packed));
47
        } parts __attribute__ ((packed));
48
    } float32_t;
48
    } float32_t;
49
   
49
   
50
typedef union {
50
typedef union {
51
    double d;
51
    double d;
52
    struct  {
52
    struct  {
53
        #ifdef __BIG_ENDIAN__
53
        #ifdef __BIG_ENDIAN__
54
        __u8 sign:1;
54
        __u8 sign:1;
55
        __u8 exp:11;
55
        __u8 exp:11;
56
        __u32 mantisa:52;
56
        __u32 mantisa:52;
57
        #else
57
        #else
58
        #ifdef __LITTLE_ENDIAN__
58
        #ifdef __LITTLE_ENDIAN__
59
        __u32 mantisa:52;
59
        __u32 mantisa:52;
60
        __u8 exp:11;
60
        __u8 exp:11;
61
        __u8    sign:1;
61
        __u8 sign:1;
62
        #else 
62
        #else 
63
        #endif
63
        #endif
64
        } parts __attribute__ ((packed));
64
        } parts __attribute__ ((packed));
65
    } float64_t;
65
    } float64_t;
66
 
66
 
-
 
67
#define FLOAT32_MAX 0x7f800000
-
 
68
#define FLOAT32_MIN 0xff800000
-
 
69
#define FLOAT64_MAX
-
 
70
#define FLOAT64_MIN
-
 
71
 
-
 
72
#define FLOAT32_BIAS 0xF7
-
 
73
#define FLOAT64_BIAS 0x3FF
-
 
74
#define FLOAT80_BIAS 0x3FFF
-
 
75
 
-
 
76
 
67
 
77
 
68
float __addsf3(float a, float b);
78
float __addsf3(float a, float b);
69
double __adddf3(double a, double b);
79
double __adddf3(double a, double b);
70
long double __addtf3(long double a, long double b);
80
long double __addtf3(long double a, long double b);
71
long double __addxf3(long double a, long double b);
81
long double __addxf3(long double a, long double b);
72
 
82
 
73
float __subsf3(float a, float b);
83
float __subsf3(float a, float b);
74
double __subdf3(double a, double b);
84
double __subdf3(double a, double b);
75
long double __subtf3(long double a, long double b);
85
long double __subtf3(long double a, long double b);
76
long double __subxf3(long double a, long double b);
86
long double __subxf3(long double a, long double b);
77
 
87
 
78
float __mulsf3(float a, float b);
88
float __mulsf3(float a, float b);
79
double __muldf3(double a, double b);
89
double __muldf3(double a, double b);
80
long double __multf3(long double a, long double b);
90
long double __multf3(long double a, long double b);
81
long double __mulxf3(long double a, long double b);
91
long double __mulxf3(long double a, long double b);
82
 
92
 
83
float __divsf3(float a, float b);
93
float __divsf3(float a, float b);
84
double __divdf3(double a, double b);
94
double __divdf3(double a, double b);
85
long double __divtf3(long double a, long double b);
95
long double __divtf3(long double a, long double b);
86
long double __divxf3(long double a, long double b);
96
long double __divxf3(long double a, long double b);
87
 
97
 
88
float __negsf2(float a);
98
float __negsf2(float a);
89
double __negdf2(double a);
99
double __negdf2(double a);
90
long double __negtf2(long double a);
100
long double __negtf2(long double a);
91
long double __negxf2(long double a);
101
long double __negxf2(long double a);
92
 
102
 
93
double __extendsfdf2(float a);
103
double __extendsfdf2(float a);
94
long double __extendsftf2(float a);
104
long double __extendsftf2(float a);
95
long double __extendsfxf2(float a);
105
long double __extendsfxf2(float a);
96
long double __extenddftf2(double a);
106
long double __extenddftf2(double a);
97
long double __extenddfxf2(double a);
107
long double __extenddfxf2(double a);
98
 
108
 
99
double __truncxfdf2(long double a);
109
double __truncxfdf2(long double a);
100
double __trunctfdf2(long double a);
110
double __trunctfdf2(long double a);
101
float __truncxfsf2(long double a);
111
float __truncxfsf2(long double a);
102
float __trunctfsf2(long double a);
112
float __trunctfsf2(long double a);
103
float __truncdfsf2(double a);
113
float __truncdfsf2(double a);
104
 
114
 
105
int __fixsfsi(float a);
115
int __fixsfsi(float a);
106
int __fixdfsi(double a);
116
int __fixdfsi(double a);
107
int __fixtfsi(long double a);
117
int __fixtfsi(long double a);
108
int __fixxfsi(long double a);
118
int __fixxfsi(long double a);
109
 
119
 
110
long __fixsfdi(float a);
120
long __fixsfdi(float a);
111
long __fixdfdi(double a);
121
long __fixdfdi(double a);
112
long __fixtfdi(long double a);
122
long __fixtfdi(long double a);
113
long __fixxfdi(long double a);
123
long __fixxfdi(long double a);
114
 
124
 
115
long long __fixsfti(float a);
125
long long __fixsfti(float a);
116
long long __fixdfti(double a);
126
long long __fixdfti(double a);
117
long long __fixtfti(long double a);
127
long long __fixtfti(long double a);
118
long long __fixxfti(long double a);
128
long long __fixxfti(long double a);
119
 
129
 
120
unsigned int __fixunssfsi(float a);
130
unsigned int __fixunssfsi(float a);
121
unsigned int __fixunsdfsi(double a);
131
unsigned int __fixunsdfsi(double a);
122
unsigned int __fixunstfsi(long double a);
132
unsigned int __fixunstfsi(long double a);
123
unsigned int __fixunsxfsi(long double a);
133
unsigned int __fixunsxfsi(long double a);
124
 
134
 
125
unsigned long __fixunssfdi(float a);
135
unsigned long __fixunssfdi(float a);
126
unsigned long __fixunsdfdi(double a);
136
unsigned long __fixunsdfdi(double a);
127
unsigned long __fixunstfdi(long double a);
137
unsigned long __fixunstfdi(long double a);
128
unsigned long __fixunsxfdi(long double a);
138
unsigned long __fixunsxfdi(long double a);
129
 
139
 
130
unsigned long long __fixunssfti(float a);
140
unsigned long long __fixunssfti(float a);
131
unsigned long long __fixunsdfti(double a);
141
unsigned long long __fixunsdfti(double a);
132
unsigned long long __fixunstfti(long double a);
142
unsigned long long __fixunstfti(long double a);
133
unsigned long long __fixunsxfti(long double a);
143
unsigned long long __fixunsxfti(long double a);
134
 
144
 
135
float __floatsisf(int i);
145
float __floatsisf(int i);
136
double __floatsidf(int i);
146
double __floatsidf(int i);
137
long double __floatsitf(int i);
147
long double __floatsitf(int i);
138
long double __floatsixf(int i);
148
long double __floatsixf(int i);
139
 
149
 
140
float __floatdisf(long i);
150
float __floatdisf(long i);
141
double __floatdidf(long i);
151
double __floatdidf(long i);
142
long double __floatditf(long i);
152
long double __floatditf(long i);
143
long double __floatdixf(long i);
153
long double __floatdixf(long i);
144
 
154
 
145
float __floattisf(long long i);
155
float __floattisf(long long i);
146
double __floattidf(long long i);
156
double __floattidf(long long i);
147
long double __floattitf(long long i);
157
long double __floattitf(long long i);
148
long double __floattixf(long long i);
158
long double __floattixf(long long i);
149
 
159
 
150
int __cmpsf2(float a, float b);
160
int __cmpsf2(float a, float b);
151
int __cmpdf2(double a, double b);
161
int __cmpdf2(double a, double b);
152
int __cmptf2(long double a, long double b);
162
int __cmptf2(long double a, long double b);
153
 
163
 
154
int __unordsf2(float a, float b);
164
int __unordsf2(float a, float b);
155
int __unorddf2(double a, double b);
165
int __unorddf2(double a, double b);
156
int __unordtf2(long double a, long double b);
166
int __unordtf2(long double a, long double b);
157
 
167
 
158
int __eqsf2(float a, float b);
168
int __eqsf2(float a, float b);
159
int __eqdf2(double a, double b);
169
int __eqdf2(double a, double b);
160
int __eqtf2(long double a, long double b);
170
int __eqtf2(long double a, long double b);
161
 
171
 
162
int __nesf2(float a, float b);
172
int __nesf2(float a, float b);
163
int __nedf2(double a, double b);
173
int __nedf2(double a, double b);
164
int __netf2(long double a, long double b);
174
int __netf2(long double a, long double b);
165
 
175
 
166
int __gesf2(float a, float b);
176
int __gesf2(float a, float b);
167
int __gedf2(double a, double b);
177
int __gedf2(double a, double b);
168
int __getf2(long double a, long double b);
178
int __getf2(long double a, long double b);
169
 
179
 
170
int __ltsf2(float a, float b);
180
int __ltsf2(float a, float b);
171
int __ltdf2(double a, double b);
181
int __ltdf2(double a, double b);
172
int __lttf2(long double a, long double b);
182
int __lttf2(long double a, long double b);
173
int __lesf2(float a, float b);
183
int __lesf2(float a, float b);
174
int __ledf2(double a, double b);
184
int __ledf2(double a, double b);
175
int __letf2(long double a, long double b);
185
int __letf2(long double a, long double b);
176
 
186
 
177
int __gtsf2(float a, float b);
187
int __gtsf2(float a, float b);
178
int __gtdf2(double a, double b);
188
int __gtdf2(double a, double b);
179
int __gttf2(long double a, long double b);
189
int __gttf2(long double a, long double b);
180
 
190
 
181
 
191
 
182
#endif
192
#endif
183
 
193
 
184
 
194