VirtualBox

source: vbox/trunk/include/iprt/stdint.h@ 3544

Last change on this file since 3544 was 3281, checked in by vboxsync, 17 years ago

Made cdefs.h and type.h work with IBM Visual Age for C++ (3.08)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
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 */
47typedef signed char __int8_t;
48typedef unsigned char __uint8_t;
49typedef short __int16_t;
50typedef unsigned short __uint16_t;
51typedef int __int32_t;
52typedef unsigned int __uint32_t;
53
54# ifdef _MSC_VER
55typedef _int64 __int64_t;
56typedef unsigned _int64 __uint64_t;
57# else
58# if defined(__IBMC__) || defined(__IBMCPP__) /* assume VAC308 without long long. */
59typedef struct { __uint32_t lo,hi; } __int64_t, __uint64_t;
60# else
61typedef long long __int64_t;
62typedef 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! */
68typedef signed long __intptr_t;
69typedef unsigned long __uintptr_t;
70#else
71typedef __int64_t __intptr_t;
72typedef __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
79typedef __int8_t int8_t;
80#define _INT8_T_DECLARED
81#endif
82
83#ifndef _INT16_T_DECLARED
84typedef __int16_t int16_t;
85#define _INT16_T_DECLARED
86#endif
87
88#ifndef _INT32_T_DECLARED
89typedef __int32_t int32_t;
90#define _INT32_T_DECLARED
91#endif
92
93#ifndef _INT64_T_DECLARED
94typedef __int64_t int64_t;
95#define _INT64_T_DECLARED
96#endif
97
98#ifndef _UINT8_T_DECLARED
99typedef __uint8_t uint8_t;
100#define _UINT8_T_DECLARED
101#endif
102
103#ifndef _UINT16_T_DECLARED
104typedef __uint16_t uint16_t;
105#define _UINT16_T_DECLARED
106#endif
107
108#ifndef _UINT32_T_DECLARED
109typedef __uint32_t uint32_t;
110#define _UINT32_T_DECLARED
111#endif
112
113#ifndef _UINT64_T_DECLARED
114typedef __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
122typedef __intptr_t intptr_t;
123typedef __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
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette