VirtualBox

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

Last change on this file since 8150 was 7170, checked in by vboxsync, 17 years ago

Doxygen fixes. (DOXYGEN -> DOXYGEN_RUNNING, ++)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 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 (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 * --------------------------------------------------------------------
25 *
26 * This code is based on:
27 *
28 * Based on various FreeBSD 5.2 headers.
29 *
30 */
31
32#ifndef ___iprt_stdint_h
33#define ___iprt_stdint_h
34
35#ifndef __STDC_CONSTANT_MACROS
36# define __STDC_CONSTANT_MACROS
37#endif
38#ifndef __STDC_LIMIT_MACROS
39# define __STDC_LIMIT_MACROS
40#endif
41
42#include <iprt/cdefs.h>
43
44#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) && !defined(_MSC_VER) && !defined(__IBMC__) && !defined(__IBMCPP__) && !defined(IPRT_NO_CRT) && !defined(DOXYGEN_RUNNING)
45# include <stdint.h>
46
47#else
48
49#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) || defined(IPRT_NO_CRT) || defined(DOXGEN_RUNNING)
50/* machine specific */
51typedef signed char __int8_t;
52typedef unsigned char __uint8_t;
53typedef short __int16_t;
54typedef unsigned short __uint16_t;
55typedef int __int32_t;
56typedef unsigned int __uint32_t;
57
58# ifdef _MSC_VER
59typedef _int64 __int64_t;
60typedef unsigned _int64 __uint64_t;
61# else
62# if defined(__IBMC__) || defined(__IBMCPP__) /* assume VAC308 without long long. */
63typedef struct { __uint32_t lo,hi; } __int64_t, __uint64_t;
64# else
65typedef long long __int64_t;
66typedef unsigned long long __uint64_t;
67# endif
68# endif
69#endif /* !linux kernel and more */
70
71#if ARCH_BITS == 32 || defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
72typedef signed long __intptr_t;
73typedef unsigned long __uintptr_t;
74#else
75typedef __int64_t __intptr_t;
76typedef __uint64_t __uintptr_t;
77#endif
78
79
80/* the stuff we use */
81#if (!defined(RT_OS_LINUX) && !defined(__KERNEL__)) || defined(IPRT_NO_CRT)
82#ifndef _INT8_T_DECLARED
83typedef __int8_t int8_t;
84#define _INT8_T_DECLARED
85#endif
86
87#ifndef _INT16_T_DECLARED
88typedef __int16_t int16_t;
89#define _INT16_T_DECLARED
90#endif
91
92#ifndef _INT32_T_DECLARED
93typedef __int32_t int32_t;
94#define _INT32_T_DECLARED
95#endif
96
97#ifndef _INT64_T_DECLARED
98typedef __int64_t int64_t;
99#define _INT64_T_DECLARED
100#endif
101
102#ifndef _UINT8_T_DECLARED
103typedef __uint8_t uint8_t;
104#define _UINT8_T_DECLARED
105#endif
106
107#ifndef _UINT16_T_DECLARED
108typedef __uint16_t uint16_t;
109#define _UINT16_T_DECLARED
110#endif
111
112#ifndef _UINT32_T_DECLARED
113typedef __uint32_t uint32_t;
114#define _UINT32_T_DECLARED
115#endif
116
117#ifndef _UINT64_T_DECLARED
118typedef __uint64_t uint64_t;
119#define _UINT64_T_DECLARED
120#endif
121
122#endif /* !linux kernel || no-crt */
123
124#if !defined(_MSC_VER) || defined(DOXYGEN_RUNNING)
125#ifndef _INTPTR_T_DECLARED
126/** Signed interger type capable of holding a pointer value, very useful for casting. */
127typedef __intptr_t intptr_t;
128/** Unsigned interger type capable of holding a pointer value, very useful for casting. */
129typedef __uintptr_t uintptr_t;
130#define _INTPTR_T_DECLARED
131#endif
132#endif /* !_MSC_VER || DOXYGEN_RUNNING */
133
134#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
135
136#define INT8_C(c) (c)
137#define INT16_C(c) (c)
138#define INT32_C(c) (c)
139#define INT64_C(c) (c ## LL)
140
141#define UINT8_C(c) (c)
142#define UINT16_C(c) (c)
143#define UINT32_C(c) (c ## U)
144#define UINT64_C(c) (c ## ULL)
145
146#define INTMAX_C(c) (c ## LL)
147#define UINTMAX_C(c) (c ## ULL)
148
149#define INT8_MIN (-0x7f-1)
150#define INT16_MIN (-0x7fff-1)
151#define INT32_MIN (-0x7fffffff-1)
152#define INT64_MIN (-0x7fffffffffffffffLL-1)
153
154#define INT8_MAX 0x7f
155#define INT16_MAX 0x7fff
156#define INT32_MAX 0x7fffffff
157#define INT64_MAX 0x7fffffffffffffffLL
158
159#define UINT8_MAX 0xff
160#define UINT16_MAX 0xffff
161#define UINT32_MAX 0xffffffffU
162#define UINT64_MAX 0xffffffffffffffffULL
163
164#endif /* !C++ || __STDC_CONSTANT_MACROS */
165
166#endif /* ! have usable stdint.h */
167
168#endif
169
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