1 | #ifndef _FIX64_H_ |
---|
2 | |
---|
3 | #define _FIX64_H_ |
---|
4 | |
---|
5 | #include <ieeefp.h> |
---|
6 | #include <math.h> |
---|
7 | #include <float.h> |
---|
8 | #include <errno.h> |
---|
9 | #include <sys/config.h> |
---|
10 | |
---|
11 | #ifdef __IEEE_LITTLE_ENDIAN |
---|
12 | #define IEEE_8087 |
---|
13 | #endif |
---|
14 | |
---|
15 | #ifdef __IEEE_BIG_ENDIAN |
---|
16 | #define IEEE_MC68k |
---|
17 | #endif |
---|
18 | |
---|
19 | #ifdef __Z8000__ |
---|
20 | #define Just_16 |
---|
21 | #endif |
---|
22 | |
---|
23 | #if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1 |
---|
24 | Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. |
---|
25 | #endif |
---|
26 | |
---|
27 | union long_double_union |
---|
28 | { |
---|
29 | long double ld; |
---|
30 | __uint32_t i[4]; |
---|
31 | }; |
---|
32 | |
---|
33 | typedef union long_double_union LONG_DOUBLE_UNION; |
---|
34 | |
---|
35 | extern void _simdstrtold (char *, char **, LONG_DOUBLE_UNION *); |
---|
36 | extern int _simdldcheck (LONG_DOUBLE_UNION *); |
---|
37 | |
---|
38 | #define SIMD_LDBL_MANT_DIG 113 |
---|
39 | |
---|
40 | #ifdef IEEE_8087 |
---|
41 | # define word0(x) (x.i[3]) |
---|
42 | # define word1(x) (x.i[2]) |
---|
43 | # define word2(x) (x.i[1]) |
---|
44 | # define word3(x) (x.i[0]) |
---|
45 | #else /* !IEEE_8087 */ |
---|
46 | # define word0(x) (x.i[0]) |
---|
47 | # define word1(x) (x.i[1]) |
---|
48 | # define word2(x) (x.i[2]) |
---|
49 | # define word3(x) (x.i[3]) |
---|
50 | #endif /* !IEEE_8087 */ |
---|
51 | |
---|
52 | #undef Exp_shift |
---|
53 | #define Exp_shift 16 |
---|
54 | #undef Exp_mask |
---|
55 | #define Exp_mask ((__uint32_t)0x7fff0000L) |
---|
56 | #undef Exp_msk1 |
---|
57 | #define Exp_msk1 ((__uint32_t)0x00010000L) |
---|
58 | #undef Bias |
---|
59 | #define Bias 16383 |
---|
60 | #undef Ebits |
---|
61 | #define Ebits 15 |
---|
62 | #undef Sign_bit |
---|
63 | #define Sign_bit ((__uint32_t)0x80000000L) |
---|
64 | #define init(x) {} |
---|
65 | |
---|
66 | union fix64_union |
---|
67 | { |
---|
68 | __uint64_t ll; |
---|
69 | __uint32_t j[2]; |
---|
70 | }; |
---|
71 | |
---|
72 | #ifdef __LITTLE_ENDIAN__ |
---|
73 | # define hiword(y) (y.j[1]) |
---|
74 | # define loword(y) (y.j[0]) |
---|
75 | #else /* __BIG_ENDIAN__ */ |
---|
76 | # define hiword(y) (y.j[0]) |
---|
77 | # define loword(y) (y.j[1]) |
---|
78 | #endif /* __BIG_ENDIAN__ */ |
---|
79 | |
---|
80 | #endif /* _FIX64_H_ */ |
---|