Rev 542 | Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 535 | cejka | 1 | /* |
| 2 | * Copyright (C) 2005 Josef Cejka |
||
| 3 | * All rights reserved. |
||
| 4 | * |
||
| 5 | * Redistribution and use in source and binary forms, with or without |
||
| 6 | * modification, are permitted provided that the following conditions |
||
| 7 | * are met: |
||
| 8 | * |
||
| 9 | * - Redistributions of source code must retain the above copyright |
||
| 10 | * notice, this list of conditions and the following disclaimer. |
||
| 11 | * - Redistributions in binary form must reproduce the above copyright |
||
| 12 | * notice, this list of conditions and the following disclaimer in the |
||
| 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 |
||
| 15 | * derived from this software without specific prior written permission. |
||
| 16 | * |
||
| 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 |
||
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
||
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
||
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||
| 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 |
||
| 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 |
||
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
| 27 | */ |
||
| 28 | |||
| 29 | #ifndef __SOFTFLOAT_H__ |
||
| 30 | #define __SOFTFLOAT_H__ |
||
| 31 | |||
| 32 | |||
| 33 | typedef union { |
||
| 34 | float f; |
||
| 35 | struct { |
||
| 36 | #ifdef __BIG_ENDIAN__ |
||
| 37 | __u8 sign:1; |
||
| 38 | __u8 exp:8; |
||
| 39 | __u32 mantisa:23; |
||
| 40 | #else |
||
| 41 | #ifdef __LITTLE_ENDIAN__ |
||
| 42 | __u32 mantisa:23; |
||
| 43 | __u8 exp:8; |
||
| 44 | __u8 sign:1; |
||
| 45 | #else |
||
| 46 | #endif |
||
| 47 | } parts __attribute__ ((packed)); |
||
| 48 | } float32_t; |
||
| 49 | |||
| 50 | typedef union { |
||
| 51 | double d; |
||
| 52 | struct { |
||
| 53 | #ifdef __BIG_ENDIAN__ |
||
| 54 | __u8 sign:1; |
||
| 55 | __u8 exp:11; |
||
| 56 | __u32 mantisa:52; |
||
| 57 | #else |
||
| 58 | #ifdef __LITTLE_ENDIAN__ |
||
| 59 | __u32 mantisa:52; |
||
| 60 | __u8 exp:11; |
||
| 61 | __u8 sign:1; |
||
| 62 | #else |
||
| 63 | #endif |
||
| 64 | } parts __attribute__ ((packed)); |
||
| 65 | } float64_t; |
||
| 66 | |||
| 67 | |||
| 68 | float __addsf3(float a, float b); |
||
| 69 | double __adddf3(double a, double b); |
||
| 70 | long double __addtf3(long double a, long double b); |
||
| 71 | long double __addxf3(long double a, long double b); |
||
| 72 | |||
| 73 | float __subsf3(float a, float b); |
||
| 74 | double __subdf3(double a, double b); |
||
| 75 | long double __subtf3(long double a, long double b); |
||
| 76 | long double __subxf3(long double a, long double b); |
||
| 77 | |||
| 78 | float __mulsf3(float a, float b); |
||
| 79 | double __muldf3(double a, double b); |
||
| 80 | long double __multf3(long double a, long double b); |
||
| 81 | long double __mulxf3(long double a, long double b); |
||
| 82 | |||
| 83 | float __divsf3(float a, float b); |
||
| 84 | double __divdf3(double a, double b); |
||
| 85 | long double __divtf3(long double a, long double b); |
||
| 86 | long double __divxf3(long double a, long double b); |
||
| 87 | |||
| 88 | float __negsf2(float a); |
||
| 89 | double __negdf2(double a); |
||
| 90 | long double __negtf2(long double a); |
||
| 91 | long double __negxf2(long double a); |
||
| 92 | |||
| 93 | double __extendsfdf2(float a); |
||
| 94 | long double __extendsftf2(float a); |
||
| 95 | long double __extendsfxf2(float a); |
||
| 96 | long double __extenddftf2(double a); |
||
| 97 | long double __extenddfxf2(double a); |
||
| 98 | |||
| 99 | double __truncxfdf2(long double a); |
||
| 100 | double __trunctfdf2(long double a); |
||
| 101 | float __truncxfsf2(long double a); |
||
| 102 | float __trunctfsf2(long double a); |
||
| 103 | float __truncdfsf2(double a); |
||
| 104 | |||
| 105 | int __fixsfsi(float a); |
||
| 106 | int __fixdfsi(double a); |
||
| 107 | int __fixtfsi(long double a); |
||
| 108 | int __fixxfsi(long double a); |
||
| 109 | |||
| 110 | long __fixsfdi(float a); |
||
| 111 | long __fixdfdi(double a); |
||
| 112 | long __fixtfdi(long double a); |
||
| 113 | long __fixxfdi(long double a); |
||
| 114 | |||
| 115 | long long __fixsfti(float a); |
||
| 116 | long long __fixdfti(double a); |
||
| 117 | long long __fixtfti(long double a); |
||
| 118 | long long __fixxfti(long double a); |
||
| 119 | |||
| 120 | unsigned int __fixunssfsi(float a); |
||
| 121 | unsigned int __fixunsdfsi(double a); |
||
| 122 | unsigned int __fixunstfsi(long double a); |
||
| 123 | unsigned int __fixunsxfsi(long double a); |
||
| 124 | |||
| 125 | unsigned long __fixunssfdi(float a); |
||
| 126 | unsigned long __fixunsdfdi(double a); |
||
| 127 | unsigned long __fixunstfdi(long double a); |
||
| 128 | unsigned long __fixunsxfdi(long double a); |
||
| 129 | |||
| 130 | unsigned long long __fixunssfti(float a); |
||
| 131 | unsigned long long __fixunsdfti(double a); |
||
| 132 | unsigned long long __fixunstfti(long double a); |
||
| 133 | unsigned long long __fixunsxfti(long double a); |
||
| 134 | |||
| 135 | float __floatsisf(int i); |
||
| 136 | double __floatsidf(int i); |
||
| 137 | long double __floatsitf(int i); |
||
| 138 | long double __floatsixf(int i); |
||
| 139 | |||
| 140 | float __floatdisf(long i); |
||
| 141 | double __floatdidf(long i); |
||
| 142 | long double __floatditf(long i); |
||
| 143 | long double __floatdixf(long i); |
||
| 144 | |||
| 145 | float __floattisf(long long i); |
||
| 146 | double __floattidf(long long i); |
||
| 147 | long double __floattitf(long long i); |
||
| 148 | long double __floattixf(long long i); |
||
| 149 | |||
| 150 | int __cmpsf2(float a, float b); |
||
| 151 | int __cmpdf2(double a, double b); |
||
| 152 | int __cmptf2(long double a, long double b); |
||
| 153 | |||
| 154 | int __unordsf2(float a, float b); |
||
| 155 | int __unorddf2(double a, double b); |
||
| 156 | int __unordtf2(long double a, long double b); |
||
| 157 | |||
| 158 | int __eqsf2(float a, float b); |
||
| 159 | int __eqdf2(double a, double b); |
||
| 160 | int __eqtf2(long double a, long double b); |
||
| 161 | |||
| 162 | int __nesf2(float a, float b); |
||
| 163 | int __nedf2(double a, double b); |
||
| 164 | int __netf2(long double a, long double b); |
||
| 165 | |||
| 166 | int __gesf2(float a, float b); |
||
| 167 | int __gedf2(double a, double b); |
||
| 168 | int __getf2(long double a, long double b); |
||
| 169 | |||
| 170 | int __ltsf2(float a, float b); |
||
| 171 | int __ltdf2(double a, double b); |
||
| 172 | int __lttf2(long double a, long double b); |
||
| 173 | int __lesf2(float a, float b); |
||
| 174 | int __ledf2(double a, double b); |
||
| 175 | int __letf2(long double a, long double b); |
||
| 176 | |||
| 177 | int __gtsf2(float a, float b); |
||
| 178 | int __gtdf2(double a, double b); |
||
| 179 | int __gttf2(long double a, long double b); |
||
| 180 | |||
| 181 | |||
| 182 | #endif |
||
| 183 |