1 | /** @file
|
---|
2 | * InnoTek Portable Runtime - stdint.h wrapper (for backlevel compilers like MSC).
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006 InnoTek Systemberatung 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(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 | typedef long long __int64_t;
|
---|
59 | typedef unsigned long long __uint64_t;
|
---|
60 | # endif
|
---|
61 | #endif /* !linux kernel */
|
---|
62 |
|
---|
63 | #if !defined(_WIN64) || defined(__i386__) || defined(__I386__) || defined(__LINUX__) /** @todo fix this, __x86__ should suffice if cdefs.h is included! */
|
---|
64 | typedef signed long __intptr_t;
|
---|
65 | typedef unsigned long __uintptr_t;
|
---|
66 | #else
|
---|
67 | typedef __int64_t __intptr_t;
|
---|
68 | typedef __uint64_t __uintptr_t;
|
---|
69 | #endif
|
---|
70 |
|
---|
71 |
|
---|
72 | /* the stuff we use */
|
---|
73 | #if (!defined(__LINUX__) && !defined(__KERNEL__)) || defined(IPRT_NO_CRT) || defined(_MSC_VER) /** @todo remove _MSC_VER check (vcc8 merge) */
|
---|
74 | #ifndef _INT8_T_DECLARED
|
---|
75 | typedef __int8_t int8_t;
|
---|
76 | #define _INT8_T_DECLARED
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | #ifndef _INT16_T_DECLARED
|
---|
80 | typedef __int16_t int16_t;
|
---|
81 | #define _INT16_T_DECLARED
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | #ifndef _INT32_T_DECLARED
|
---|
85 | typedef __int32_t int32_t;
|
---|
86 | #define _INT32_T_DECLARED
|
---|
87 | #endif
|
---|
88 |
|
---|
89 | #ifndef _INT64_T_DECLARED
|
---|
90 | typedef __int64_t int64_t;
|
---|
91 | #define _INT64_T_DECLARED
|
---|
92 | #endif
|
---|
93 |
|
---|
94 | #ifndef _UINT8_T_DECLARED
|
---|
95 | typedef __uint8_t uint8_t;
|
---|
96 | #define _UINT8_T_DECLARED
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | #ifndef _UINT16_T_DECLARED
|
---|
100 | typedef __uint16_t uint16_t;
|
---|
101 | #define _UINT16_T_DECLARED
|
---|
102 | #endif
|
---|
103 |
|
---|
104 | #ifndef _UINT32_T_DECLARED
|
---|
105 | typedef __uint32_t uint32_t;
|
---|
106 | #define _UINT32_T_DECLARED
|
---|
107 | #endif
|
---|
108 |
|
---|
109 | #ifndef _UINT64_T_DECLARED
|
---|
110 | typedef __uint64_t uint64_t;
|
---|
111 | #define _UINT64_T_DECLARED
|
---|
112 | #endif
|
---|
113 |
|
---|
114 | #endif /* !linux kernel || no-crt */
|
---|
115 |
|
---|
116 | #ifndef _MSC_VER
|
---|
117 | #ifndef _INTPTR_T_DECLARED
|
---|
118 | typedef __intptr_t intptr_t;
|
---|
119 | typedef __uintptr_t uintptr_t;
|
---|
120 | #define _INTPTR_T_DECLARED
|
---|
121 | #endif
|
---|
122 | #endif /* !_MSC_VER */
|
---|
123 |
|
---|
124 | #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
|
---|
125 |
|
---|
126 | #define INT8_C(c) (c)
|
---|
127 | #define INT16_C(c) (c)
|
---|
128 | #define INT32_C(c) (c)
|
---|
129 | #define INT64_C(c) (c ## LL)
|
---|
130 |
|
---|
131 | #define UINT8_C(c) (c)
|
---|
132 | #define UINT16_C(c) (c)
|
---|
133 | #define UINT32_C(c) (c ## U)
|
---|
134 | #define UINT64_C(c) (c ## ULL)
|
---|
135 |
|
---|
136 | #define INTMAX_C(c) (c ## LL)
|
---|
137 | #define UINTMAX_C(c) (c ## ULL)
|
---|
138 |
|
---|
139 | #define INT8_MIN (-0x7f-1)
|
---|
140 | #define INT16_MIN (-0x7fff-1)
|
---|
141 | #define INT32_MIN (-0x7fffffff-1)
|
---|
142 | #define INT64_MIN (-0x7fffffffffffffffLL-1)
|
---|
143 |
|
---|
144 | #define INT8_MAX 0x7f
|
---|
145 | #define INT16_MAX 0x7fff
|
---|
146 | #define INT32_MAX 0x7fffffff
|
---|
147 | #define INT64_MAX 0x7fffffffffffffffLL
|
---|
148 |
|
---|
149 | #define UINT8_MAX 0xff
|
---|
150 | #define UINT16_MAX 0xffff
|
---|
151 | #define UINT32_MAX 0xffffffffU
|
---|
152 | #define UINT64_MAX 0xffffffffffffffffULL
|
---|
153 |
|
---|
154 | #endif /* !C++ || __STDC_CONSTANT_MACROS */
|
---|
155 |
|
---|
156 | #endif /* _MSC_VER */
|
---|
157 |
|
---|
158 | #endif
|
---|
159 |
|
---|