Rev 563 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 563 | Rev 647 | ||
---|---|---|---|
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 | - | ||
33 | typedef union { |
- | |
34 | float f; |
- | |
35 | struct { |
- | |
36 | #ifdef __BIG_ENDIAN__ |
- | |
37 | __u32 sign:1; |
- | |
38 | __u32 exp:8; |
- | |
39 | __u32 mantisa:23; |
- | |
40 | #elif defined __LITTLE_ENDIAN__ |
- | |
41 | __u32 mantisa:23; |
- | |
42 | __u32 exp:8; |
- | |
43 | __u32 sign:1; |
- | |
44 | #else |
- | |
45 | #error "Unknown endians." |
- | |
46 | #endif |
- | |
47 | } parts __attribute__ ((packed)); |
- | |
48 | } float32; |
- | |
49 | - | ||
50 | typedef union { |
- | |
51 | double d; |
- | |
52 | struct { |
- | |
53 | #ifdef __BIG_ENDIAN__ |
- | |
54 | __u64 sign:1; |
- | |
55 | __u64 exp:11; |
- | |
56 | __u64 mantisa:52; |
- | |
57 | #elif defined __LITTLE_ENDIAN__ |
- | |
58 | __u64 mantisa:52; |
- | |
59 | __u64 exp:11; |
- | |
60 | __u64 sign:1; |
- | |
61 | #else |
- | |
62 | #error "Unknown endians." |
- | |
63 | #endif |
- | |
64 | } parts __attribute__ ((packed)); |
- | |
65 | } float64; |
- | |
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 | - | ||
77 | - | ||
78 | float __addsf3(float a, float b); |
32 | float __addsf3(float a, float b); |
79 | double __adddf3(double a, double b); |
33 | double __adddf3(double a, double b); |
80 | long double __addtf3(long double a, long double b); |
34 | long double __addtf3(long double a, long double b); |
81 | long double __addxf3(long double a, long double b); |
35 | long double __addxf3(long double a, long double b); |
82 | 36 | ||
83 | float __subsf3(float a, float b); |
37 | float __subsf3(float a, float b); |
84 | double __subdf3(double a, double b); |
38 | double __subdf3(double a, double b); |
85 | long double __subtf3(long double a, long double b); |
39 | long double __subtf3(long double a, long double b); |
86 | long double __subxf3(long double a, long double b); |
40 | long double __subxf3(long double a, long double b); |
87 | 41 | ||
88 | float __mulsf3(float a, float b); |
42 | float __mulsf3(float a, float b); |
89 | double __muldf3(double a, double b); |
43 | double __muldf3(double a, double b); |
90 | long double __multf3(long double a, long double b); |
44 | long double __multf3(long double a, long double b); |
91 | long double __mulxf3(long double a, long double b); |
45 | long double __mulxf3(long double a, long double b); |
92 | 46 | ||
93 | float __divsf3(float a, float b); |
47 | float __divsf3(float a, float b); |
94 | double __divdf3(double a, double b); |
48 | double __divdf3(double a, double b); |
95 | long double __divtf3(long double a, long double b); |
49 | long double __divtf3(long double a, long double b); |
96 | long double __divxf3(long double a, long double b); |
50 | long double __divxf3(long double a, long double b); |
97 | 51 | ||
98 | float __negsf2(float a); |
52 | float __negsf2(float a); |
99 | double __negdf2(double a); |
53 | double __negdf2(double a); |
100 | long double __negtf2(long double a); |
54 | long double __negtf2(long double a); |
101 | long double __negxf2(long double a); |
55 | long double __negxf2(long double a); |
102 | 56 | ||
103 | double __extendsfdf2(float a); |
57 | double __extendsfdf2(float a); |
104 | long double __extendsftf2(float a); |
58 | long double __extendsftf2(float a); |
105 | long double __extendsfxf2(float a); |
59 | long double __extendsfxf2(float a); |
106 | long double __extenddftf2(double a); |
60 | long double __extenddftf2(double a); |
107 | long double __extenddfxf2(double a); |
61 | long double __extenddfxf2(double a); |
108 | 62 | ||
109 | double __truncxfdf2(long double a); |
63 | double __truncxfdf2(long double a); |
110 | double __trunctfdf2(long double a); |
64 | double __trunctfdf2(long double a); |
111 | float __truncxfsf2(long double a); |
65 | float __truncxfsf2(long double a); |
112 | float __trunctfsf2(long double a); |
66 | float __trunctfsf2(long double a); |
113 | float __truncdfsf2(double a); |
67 | float __truncdfsf2(double a); |
114 | 68 | ||
115 | int __fixsfsi(float a); |
69 | int __fixsfsi(float a); |
116 | int __fixdfsi(double a); |
70 | int __fixdfsi(double a); |
117 | int __fixtfsi(long double a); |
71 | int __fixtfsi(long double a); |
118 | int __fixxfsi(long double a); |
72 | int __fixxfsi(long double a); |
119 | 73 | ||
120 | long __fixsfdi(float a); |
74 | long __fixsfdi(float a); |
121 | long __fixdfdi(double a); |
75 | long __fixdfdi(double a); |
122 | long __fixtfdi(long double a); |
76 | long __fixtfdi(long double a); |
123 | long __fixxfdi(long double a); |
77 | long __fixxfdi(long double a); |
124 | 78 | ||
125 | long long __fixsfti(float a); |
79 | long long __fixsfti(float a); |
126 | long long __fixdfti(double a); |
80 | long long __fixdfti(double a); |
127 | long long __fixtfti(long double a); |
81 | long long __fixtfti(long double a); |
128 | long long __fixxfti(long double a); |
82 | long long __fixxfti(long double a); |
129 | 83 | ||
130 | unsigned int __fixunssfsi(float a); |
84 | unsigned int __fixunssfsi(float a); |
131 | unsigned int __fixunsdfsi(double a); |
85 | unsigned int __fixunsdfsi(double a); |
132 | unsigned int __fixunstfsi(long double a); |
86 | unsigned int __fixunstfsi(long double a); |
133 | unsigned int __fixunsxfsi(long double a); |
87 | unsigned int __fixunsxfsi(long double a); |
134 | 88 | ||
135 | unsigned long __fixunssfdi(float a); |
89 | unsigned long __fixunssfdi(float a); |
136 | unsigned long __fixunsdfdi(double a); |
90 | unsigned long __fixunsdfdi(double a); |
137 | unsigned long __fixunstfdi(long double a); |
91 | unsigned long __fixunstfdi(long double a); |
138 | unsigned long __fixunsxfdi(long double a); |
92 | unsigned long __fixunsxfdi(long double a); |
139 | 93 | ||
140 | unsigned long long __fixunssfti(float a); |
94 | unsigned long long __fixunssfti(float a); |
141 | unsigned long long __fixunsdfti(double a); |
95 | unsigned long long __fixunsdfti(double a); |
142 | unsigned long long __fixunstfti(long double a); |
96 | unsigned long long __fixunstfti(long double a); |
143 | unsigned long long __fixunsxfti(long double a); |
97 | unsigned long long __fixunsxfti(long double a); |
144 | 98 | ||
145 | float __floatsisf(int i); |
99 | float __floatsisf(int i); |
146 | double __floatsidf(int i); |
100 | double __floatsidf(int i); |
147 | long double __floatsitf(int i); |
101 | long double __floatsitf(int i); |
148 | long double __floatsixf(int i); |
102 | long double __floatsixf(int i); |
149 | 103 | ||
150 | float __floatdisf(long i); |
104 | float __floatdisf(long i); |
151 | double __floatdidf(long i); |
105 | double __floatdidf(long i); |
152 | long double __floatditf(long i); |
106 | long double __floatditf(long i); |
153 | long double __floatdixf(long i); |
107 | long double __floatdixf(long i); |
154 | 108 | ||
155 | float __floattisf(long long i); |
109 | float __floattisf(long long i); |
156 | double __floattidf(long long i); |
110 | double __floattidf(long long i); |
157 | long double __floattitf(long long i); |
111 | long double __floattitf(long long i); |
158 | long double __floattixf(long long i); |
112 | long double __floattixf(long long i); |
159 | 113 | ||
160 | int __cmpsf2(float a, float b); |
114 | int __cmpsf2(float a, float b); |
161 | int __cmpdf2(double a, double b); |
115 | int __cmpdf2(double a, double b); |
162 | int __cmptf2(long double a, long double b); |
116 | int __cmptf2(long double a, long double b); |
163 | 117 | ||
164 | int __unordsf2(float a, float b); |
118 | int __unordsf2(float a, float b); |
165 | int __unorddf2(double a, double b); |
119 | int __unorddf2(double a, double b); |
166 | int __unordtf2(long double a, long double b); |
120 | int __unordtf2(long double a, long double b); |
167 | 121 | ||
168 | int __eqsf2(float a, float b); |
122 | int __eqsf2(float a, float b); |
169 | int __eqdf2(double a, double b); |
123 | int __eqdf2(double a, double b); |
170 | int __eqtf2(long double a, long double b); |
124 | int __eqtf2(long double a, long double b); |
171 | 125 | ||
172 | int __nesf2(float a, float b); |
126 | int __nesf2(float a, float b); |
173 | int __nedf2(double a, double b); |
127 | int __nedf2(double a, double b); |
174 | int __netf2(long double a, long double b); |
128 | int __netf2(long double a, long double b); |
175 | 129 | ||
176 | int __gesf2(float a, float b); |
130 | int __gesf2(float a, float b); |
177 | int __gedf2(double a, double b); |
131 | int __gedf2(double a, double b); |
178 | int __getf2(long double a, long double b); |
132 | int __getf2(long double a, long double b); |
179 | 133 | ||
180 | int __ltsf2(float a, float b); |
134 | int __ltsf2(float a, float b); |
181 | int __ltdf2(double a, double b); |
135 | int __ltdf2(double a, double b); |
182 | int __lttf2(long double a, long double b); |
136 | int __lttf2(long double a, long double b); |
183 | int __lesf2(float a, float b); |
137 | int __lesf2(float a, float b); |
184 | int __ledf2(double a, double b); |
138 | int __ledf2(double a, double b); |
185 | int __letf2(long double a, long double b); |
139 | int __letf2(long double a, long double b); |
186 | 140 | ||
187 | int __gtsf2(float a, float b); |
141 | int __gtsf2(float a, float b); |
188 | int __gtdf2(double a, double b); |
142 | int __gtdf2(double a, double b); |
189 | int __gttf2(long double a, long double b); |
143 | int __gttf2(long double a, long double b); |
190 | 144 | ||
191 | 145 | ||
192 | #endif |
146 | #endif |
193 | 147 | ||
194 | 148 |