]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Main/Arm/int_types.h
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / StdLib / LibC / Main / Arm / int_types.h
CommitLineData
d799c028
HL
1/**\r
2University of Illinois/NCSA\r
3Open Source License\r
4\r
5Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT\r
6\r
7All rights reserved.\r
8\r
9Developed 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
17Permission is hereby granted, free of charge, to any person obtaining a copy of\r
18this software and associated documentation files (the "Software"), to deal with\r
19the Software without restriction, including without limitation the rights to\r
20use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\r
21of the Software, and to permit persons to whom the Software is furnished to do\r
22so, 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
36THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
37IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
38FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
39CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
40LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
41OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE\r
42SOFTWARE.\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
50typedef int si_int;\r
51typedef unsigned su_int;\r
52\r
53typedef long long di_int;\r
54typedef unsigned long long du_int;\r
55\r
56typedef 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
71typedef 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
91typedef int ti_int __attribute__ ((mode (TI)));\r
92typedef unsigned tu_int __attribute__ ((mode (TI)));\r
93\r
94typedef 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
109typedef 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
124static 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
131static 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
140typedef union\r
141{\r
142 su_int u;\r
143 float f;\r
144} float_bits;\r
145\r
146typedef union\r
147{\r
148 udwords u;\r
149 double f;\r
150} double_bits;\r
151\r
152typedef 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
163typedef 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