Rev 2798 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2798 | Rev 4556 | ||
---|---|---|---|
Line 24... | Line 24... | ||
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 | /** @addtogroup softfloat |
29 | /** @addtogroup softfloat |
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | /** @file |
32 | /** @file |
33 | */ |
33 | */ |
34 | 34 | ||
Line 39... | Line 39... | ||
39 | #include <stdint.h> |
39 | #include <stdint.h> |
40 | 40 | ||
41 | typedef union { |
41 | typedef union { |
42 | float f; |
42 | float f; |
43 | uint32_t binary; |
43 | uint32_t binary; |
44 | 44 | ||
45 | struct { |
45 | struct { |
46 | #if defined(ARCH_IS_BIG_ENDIAN) |
46 | #if defined(__BE__) |
47 | uint32_t sign:1; |
47 | uint32_t sign : 1; |
48 | uint32_t exp:8; |
48 | uint32_t exp : 8; |
49 | uint32_t fraction:23; |
49 | uint32_t fraction : 23; |
50 | #elif defined(ARCH_IS_LITTLE_ENDIAN) |
50 | #elif defined(__LE__) |
51 | uint32_t fraction:23; |
51 | uint32_t fraction : 23; |
52 | uint32_t exp:8; |
52 | uint32_t exp : 8; |
53 | uint32_t sign:1; |
53 | uint32_t sign : 1; |
54 | #else |
54 | #else |
55 | #error "Unknown endians." |
55 | #error Unknown endianess |
56 | #endif |
56 | #endif |
57 | } parts __attribute__ ((packed)); |
57 | } parts __attribute__ ((packed)); |
58 | } float32; |
58 | } float32; |
59 | 59 | ||
60 | typedef union { |
60 | typedef union { |
61 | double d; |
61 | double d; |
62 | uint64_t binary; |
62 | uint64_t binary; |
63 | 63 | ||
64 | struct { |
64 | struct { |
65 | #if defined(ARCH_IS_BIG_ENDIAN) |
65 | #if defined(__BE__) |
66 | uint64_t sign:1; |
66 | uint64_t sign : 1; |
67 | uint64_t exp:11; |
67 | uint64_t exp : 11; |
68 | uint64_t fraction:52; |
68 | uint64_t fraction : 52; |
69 | #elif defined(ARCH_IS_LITTLE_ENDIAN) |
69 | #elif defined(__LE__) |
70 | uint64_t fraction:52; |
70 | uint64_t fraction : 52; |
71 | uint64_t exp:11; |
71 | uint64_t exp : 11; |
72 | uint64_t sign:1; |
72 | uint64_t sign : 1; |
73 | #else |
73 | #else |
74 | #error "Unknown endians." |
74 | #error Unknown endianess |
75 | #endif |
75 | #endif |
76 | } parts __attribute__ ((packed)); |
76 | } parts __attribute__ ((packed)); |
77 | } float64; |
77 | } float64; |
78 | 78 | ||
79 | #define FLOAT32_MAX 0x7f800000 |
79 | #define FLOAT32_MAX 0x7f800000 |
80 | #define FLOAT32_MIN 0xff800000 |
80 | #define FLOAT32_MIN 0xff800000 |
81 | #define FLOAT64_MAX |
81 | #define FLOAT64_MAX |
82 | #define FLOAT64_MIN |
82 | #define FLOAT64_MIN |
Line 107... | Line 107... | ||
107 | #define FLOAT80_BIAS 0x3FFF |
107 | #define FLOAT80_BIAS 0x3FFF |
108 | 108 | ||
109 | 109 | ||
110 | #endif |
110 | #endif |
111 | 111 | ||
112 | - | ||
113 | /** @} |
112 | /** @} |
114 | */ |
113 | */ |
115 | - |