1 | /** @file
|
---|
2 | * innotek Portable Runtime - stdint.h wrapper (for backlevel compilers like MSC).
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License as published by the Free Software Foundation,
|
---|
12 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
13 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
14 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * If you received this file as part of a commercial VirtualBox
|
---|
17 | * distribution, then only the terms of your commercial VirtualBox
|
---|
18 | * license agreement apply instead of the previous paragraph.
|
---|
19 | *
|
---|
20 | * --------------------------------------------------------------------
|
---|
21 | *
|
---|
22 | * This code is based on:
|
---|
23 | *
|
---|
24 | * Based on various FreeBSD 5.2 headers.
|
---|
25 | *
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef __iprt_stdint_h__
|
---|
29 | #define __iprt_stdint_h__
|
---|
30 |
|
---|
31 | #ifndef __STDC_CONSTANT_MACROS
|
---|
32 | # define __STDC_CONSTANT_MACROS
|
---|
33 | #endif
|
---|
34 | #ifndef __STDC_LIMIT_MACROS
|
---|
35 | # define __STDC_LIMIT_MACROS
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #include <iprt/cdefs.h>
|
---|
39 |
|
---|
40 | #if (!defined(__LINUX__) || !defined(__KERNEL__)) && !defined(_MSC_VER) && !defined(__IBMC__) && !defined(__IBMCPP__) && !defined(IPRT_NO_CRT)
|
---|
41 | # include <stdint.h>
|
---|
42 |
|
---|
43 | #else
|
---|
44 |
|
---|
45 | #if (!defined(__LINUX__) && !defined(__KERNEL__)) || defined(IPRT_NO_CRT) || defined(_MSC_VER) /** @todo remove _MSC_VER check (vcc8 merge) */
|
---|
46 | /* machine specific */
|
---|
47 | typedef signed char __int8_t;
|
---|
48 | typedef unsigned char __uint8_t;
|
---|
49 | typedef short __int16_t;
|
---|
50 | typedef unsigned short __uint16_t;
|
---|
51 | typedef int __int32_t;
|
---|
52 | typedef unsigned int __uint32_t;
|
---|
53 |
|
---|
54 | # ifdef _MSC_VER
|
---|
55 | typedef _int64 __int64_t;
|
---|
56 | typedef unsigned _int64 __uint64_t;
|
---|
57 | # else
|
---|
58 | # if defined(__IBMC__) || defined(__IBMCPP__) /* assume VAC308 without long long. */
|
---|
59 | typedef struct { __uint32_t lo,hi; } __int64_t, __uint64_t;
|
---|
60 | # else
|
---|
61 | typedef long long __int64_t;
|
---|
62 | typedef unsigned long long __uint64_t;
|
---|
63 | # endif
|
---|
64 | # endif
|
---|
65 | #endif /* !linux kernel */
|
---|
66 |
|
---|
67 | #if !defined(_WIN64) || defined(__i386__) || defined(__I386__) || defined(__LINUX__) /** @todo fix this, __x86__ should suffice if cdefs.h is included! */
|
---|
68 | typedef signed long __intptr_t;
|
---|
69 | typedef unsigned long __uintptr_t;
|
---|
70 | #else
|
---|
71 | typedef __int64_t __intptr_t;
|
---|
72 | typedef __uint64_t __uintptr_t;
|
---|
73 | #endif
|
---|
74 |
|
---|
75 |
|
---|
76 | /* the stuff we use */
|
---|
77 | #if (!defined(__LINUX__) && !defined(__KERNEL__)) || defined(IPRT_NO_CRT) || defined(_MSC_VER) /** @todo remove _MSC_VER check (vcc8 merge) */
|
---|
78 | #ifndef _INT8_T_DECLARED
|
---|
79 | typedef __int8_t int8_t;
|
---|
80 | #define _INT8_T_DECLARED
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | #ifndef _INT16_T_DECLARED
|
---|
84 | typedef __int16_t int16_t;
|
---|
85 | #define _INT16_T_DECLARED
|
---|
86 | #endif
|
---|
87 |
|
---|
88 | #ifndef _INT32_T_DECLARED
|
---|
89 | typedef __int32_t int32_t;
|
---|
90 | #define _INT32_T_DECLARED
|
---|
91 | #endif
|
---|
92 |
|
---|
93 | #ifndef _INT64_T_DECLARED
|
---|
94 | typedef __int64_t int64_t;
|
---|
95 | #define _INT64_T_DECLARED
|
---|
96 | #endif
|
---|
97 |
|
---|
98 | #ifndef _UINT8_T_DECLARED
|
---|
99 | typedef __uint8_t uint8_t;
|
---|
100 | #define _UINT8_T_DECLARED
|
---|
101 | #endif
|
---|
102 |
|
---|
103 | #ifndef _UINT16_T_DECLARED
|
---|
104 | typedef __uint16_t uint16_t;
|
---|
105 | #define _UINT16_T_DECLARED
|
---|
106 | #endif
|
---|
107 |
|
---|
108 | #ifndef _UINT32_T_DECLARED
|
---|
109 | typedef __uint32_t uint32_t;
|
---|
110 | #define _UINT32_T_DECLARED
|
---|
111 | #endif
|
---|
112 |
|
---|
113 | #ifndef _UINT64_T_DECLARED
|
---|
114 | typedef __uint64_t uint64_t;
|
---|
115 | #define _UINT64_T_DECLARED
|
---|
116 | #endif
|
---|
117 |
|
---|
118 | #endif /* !linux kernel || no-crt */
|
---|
119 |
|
---|
120 | #ifndef _MSC_VER
|
---|
121 | #ifndef _INTPTR_T_DECLARED
|
---|
122 | typedef __intptr_t intptr_t;
|
---|
123 | typedef __uintptr_t uintptr_t;
|
---|
124 | #define _INTPTR_T_DECLARED
|
---|
125 | #endif
|
---|
126 | #endif /* !_MSC_VER */
|
---|
127 |
|
---|
128 | #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
|
---|
129 |
|
---|
130 | #define INT8_C(c) (c)
|
---|
131 | #define INT16_C(c) (c)
|
---|
132 | #define INT32_C(c) (c)
|
---|
133 | #define INT64_C(c) (c ## LL)
|
---|
134 |
|
---|
135 | #define UINT8_C(c) (c)
|
---|
136 | #define UINT16_C(c) (c)
|
---|
137 | #define UINT32_C(c) (c ## U)
|
---|
138 | #define UINT64_C(c) (c ## ULL)
|
---|
139 |
|
---|
140 | #define INTMAX_C(c) (c ## LL)
|
---|
141 | #define UINTMAX_C(c) (c ## ULL)
|
---|
142 |
|
---|
143 | #define INT8_MIN (-0x7f-1)
|
---|
144 | #define INT16_MIN (-0x7fff-1)
|
---|
145 | #define INT32_MIN (-0x7fffffff-1)
|
---|
146 | #define INT64_MIN (-0x7fffffffffffffffLL-1)
|
---|
147 |
|
---|
148 | #define INT8_MAX 0x7f
|
---|
149 | #define INT16_MAX 0x7fff
|
---|
150 | #define INT32_MAX 0x7fffffff
|
---|
151 | #define INT64_MAX 0x7fffffffffffffffLL
|
---|
152 |
|
---|
153 | #define UINT8_MAX 0xff
|
---|
154 | #define UINT16_MAX 0xffff
|
---|
155 | #define UINT32_MAX 0xffffffffU
|
---|
156 | #define UINT64_MAX 0xffffffffffffffffULL
|
---|
157 |
|
---|
158 | #endif /* !C++ || __STDC_CONSTANT_MACROS */
|
---|
159 |
|
---|
160 | #endif /* _MSC_VER */
|
---|
161 |
|
---|
162 | #endif
|
---|
163 |
|
---|