]>
Commit | Line | Data |
---|---|---|
d799c028 HL |
1 | /**\r |
2 | University of Illinois/NCSA\r | |
3 | Open Source License\r | |
4 | \r | |
5 | Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT\r | |
6 | \r | |
7 | All rights reserved.\r | |
8 | \r | |
9 | Developed by:\r | |
10 | \r | |
11 | LLVM Team\r | |
12 | \r | |
13 | University of Illinois at Urbana-Champaign\r | |
14 | \r | |
15 | http://llvm.org\r | |
16 | \r | |
17 | Permission is hereby granted, free of charge, to any person obtaining a copy of\r | |
18 | this software and associated documentation files (the "Software"), to deal with\r | |
19 | the Software without restriction, including without limitation the rights to\r | |
20 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r | |
21 | of the Software, and to permit persons to whom the Software is furnished to do\r | |
22 | so, subject to the following conditions:\r | |
23 | \r | |
24 | * Redistributions of source code must retain the above copyright notice,\r | |
25 | this list of conditions and the following disclaimers.\r | |
26 | \r | |
27 | * Redistributions in binary form must reproduce the above copyright notice,\r | |
28 | this list of conditions and the following disclaimers in the\r | |
29 | documentation and/or other materials provided with the distribution.\r | |
30 | \r | |
31 | * Neither the names of the LLVM Team, University of Illinois at\r | |
32 | Urbana-Champaign, nor the names of its contributors may be used to\r | |
33 | endorse or promote products derived from this Software without specific\r | |
34 | prior written permission.\r | |
35 | \r | |
36 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r | |
37 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r | |
38 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r | |
39 | CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r | |
40 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r | |
41 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r | |
42 | SOFTWARE.\r | |
43 | **/\r | |
44 | \r | |
45 | #ifndef INT_TYPES_H\r | |
46 | #define INT_TYPES_H\r | |
47 | \r | |
48 | #include "int_endianness.h"\r | |
49 | \r | |
50 | typedef int si_int;\r | |
51 | typedef unsigned su_int;\r | |
52 | \r | |
53 | typedef long long di_int;\r | |
54 | typedef unsigned long long du_int;\r | |
55 | \r | |
56 | typedef union\r | |
57 | {\r | |
58 | di_int all;\r | |
59 | struct\r | |
60 | {\r | |
61 | #if _YUGA_LITTLE_ENDIAN\r | |
62 | su_int low;\r | |
63 | si_int high;\r | |
64 | #else\r | |
65 | si_int high;\r | |
66 | su_int low;\r | |
67 | #endif /* _YUGA_LITTLE_ENDIAN */\r | |
68 | }s;\r | |
69 | } dwords;\r | |
70 | \r | |
71 | typedef union\r | |
72 | {\r | |
73 | du_int all;\r | |
74 | struct\r | |
75 | {\r | |
76 | #if _YUGA_LITTLE_ENDIAN\r | |
77 | su_int low;\r | |
78 | su_int high;\r | |
79 | #else\r | |
80 | su_int high;\r | |
81 | su_int low;\r | |
82 | #endif /* _YUGA_LITTLE_ENDIAN */\r | |
83 | }s;\r | |
84 | } udwords;\r | |
85 | \r | |
86 | #if __LP64__\r | |
87 | #define CRT_HAS_128BIT\r | |
88 | #endif\r | |
89 | \r | |
90 | #ifdef CRT_HAS_128BIT\r | |
91 | typedef int ti_int __attribute__ ((mode (TI)));\r | |
92 | typedef unsigned tu_int __attribute__ ((mode (TI)));\r | |
93 | \r | |
94 | typedef union\r | |
95 | {\r | |
96 | ti_int all;\r | |
97 | struct\r | |
98 | {\r | |
99 | #if _YUGA_LITTLE_ENDIAN\r | |
100 | du_int low;\r | |
101 | di_int high;\r | |
102 | #else\r | |
103 | di_int high;\r | |
104 | du_int low;\r | |
105 | #endif /* _YUGA_LITTLE_ENDIAN */\r | |
106 | }s;\r | |
107 | } twords;\r | |
108 | \r | |
109 | typedef union\r | |
110 | {\r | |
111 | tu_int all;\r | |
112 | struct\r | |
113 | {\r | |
114 | #if _YUGA_LITTLE_ENDIAN\r | |
115 | du_int low;\r | |
116 | du_int high;\r | |
117 | #else\r | |
118 | du_int high;\r | |
119 | du_int low;\r | |
120 | #endif /* _YUGA_LITTLE_ENDIAN */\r | |
121 | }s;\r | |
122 | } utwords;\r | |
123 | \r | |
124 | static inline ti_int make_ti(di_int h, di_int l) {\r | |
125 | twords r;\r | |
126 | r.s.high = h;\r | |
127 | r.s.low = l;\r | |
128 | return r.all;\r | |
129 | }\r | |
130 | \r | |
131 | static inline tu_int make_tu(du_int h, du_int l) {\r | |
132 | utwords r;\r | |
133 | r.s.high = h;\r | |
134 | r.s.low = l;\r | |
135 | return r.all;\r | |
136 | }\r | |
137 | \r | |
138 | #endif /* CRT_HAS_128BIT */\r | |
139 | \r | |
140 | typedef union\r | |
141 | {\r | |
142 | su_int u;\r | |
143 | float f;\r | |
144 | } float_bits;\r | |
145 | \r | |
146 | typedef union\r | |
147 | {\r | |
148 | udwords u;\r | |
149 | double f;\r | |
150 | } double_bits;\r | |
151 | \r | |
152 | typedef struct\r | |
153 | {\r | |
154 | #if _YUGA_LITTLE_ENDIAN\r | |
155 | udwords low;\r | |
156 | udwords high;\r | |
157 | #else\r | |
158 | udwords high;\r | |
159 | udwords low;\r | |
160 | #endif /* _YUGA_LITTLE_ENDIAN */\r | |
161 | } uqwords;\r | |
162 | \r | |
163 | typedef union\r | |
164 | {\r | |
165 | uqwords u;\r | |
166 | long double f;\r | |
167 | } long_double_bits;\r | |
168 | \r | |
169 | #endif /* INT_TYPES_H */\r | |
170 | \r |