VirtualBox

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

Last change on this file since 12747 was 8245, checked in by vboxsync, 17 years ago

rebranding: IPRT files again.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/** @file
2 * IPRT - stdint.h wrapper (for backlevel compilers like MSC).
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 * --------------------------------------------------------------------
29 *
30 * This code is based on:
31 *
32 * Based on various FreeBSD 5.2 headers.
33 *
34 */
35
36#ifndef ___iprt_stdint_h
37#define ___iprt_stdint_h
38
39#ifndef __STDC_CONSTANT_MACROS
40# define __STDC_CONSTANT_MACROS
41#endif
42#ifndef __STDC_LIMIT_MACROS
43# define __STDC_LIMIT_MACROS
44#endif
45
46#include <iprt/cdefs.h>
47
48#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) && !defined(_MSC_VER) && !defined(__IBMC__) && !defined(__IBMCPP__) && !defined(IPRT_NO_CRT) && !defined(DOXYGEN_RUNNING)
49# include <stdint.h>
50
51#else
52
53#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) || defined(IPRT_NO_CRT) || defined(DOXGEN_RUNNING)
54/* machine specific */
55typedef signed char __int8_t;
56typedef unsigned char __uint8_t;
57typedef short __int16_t;
58typedef unsigned short __uint16_t;
59typedef int __int32_t;
60typedef unsigned int __uint32_t;
61
62# ifdef _MSC_VER
63typedef _int64 __int64_t;
64typedef unsigned _int64 __uint64_t;
65# else
66# if defined(__IBMC__) || defined(__IBMCPP__) /* assume VAC308 without long long. */
67typedef struct { __uint32_t lo,hi; } __int64_t, __uint64_t;
68# else
69typedef long long __int64_t;
70typedef unsigned long long __uint64_t;
71# endif
72# endif
73#endif /* !linux kernel and more */
74
75#if ARCH_BITS == 32 || defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
76typedef signed long __intptr_t;
77typedef unsigned long __uintptr_t;
78#else
79typedef __int64_t __intptr_t;
80typedef __uint64_t __uintptr_t;
81#endif
82
83
84/* the stuff we use */
85#if (!defined(RT_OS_LINUX) && !defined(__KERNEL__)) || defined(IPRT_NO_CRT)
86#ifndef _INT8_T_DECLARED
87typedef __int8_t int8_t;
88#define _INT8_T_DECLARED
89#endif
90
91#ifndef _INT16_T_DECLARED
92typedef __int16_t int16_t;
93#define _INT16_T_DECLARED
94#endif
95
96#ifndef _INT32_T_DECLARED
97typedef __int32_t int32_t;
98#define _INT32_T_DECLARED
99#endif
100
101#ifndef _INT64_T_DECLARED
102typedef __int64_t int64_t;
103#define _INT64_T_DECLARED
104#endif
105
106#ifndef _UINT8_T_DECLARED
107typedef __uint8_t uint8_t;
108#define _UINT8_T_DECLARED
109#endif
110
111#ifndef _UINT16_T_DECLARED
112typedef __uint16_t uint16_t;
113#define _UINT16_T_DECLARED
114#endif
115
116#ifndef _UINT32_T_DECLARED
117typedef __uint32_t uint32_t;
118#define _UINT32_T_DECLARED
119#endif
120
121#ifndef _UINT64_T_DECLARED
122typedef __uint64_t uint64_t;
123#define _UINT64_T_DECLARED
124#endif
125
126#endif /* !linux kernel || no-crt */
127
128#if !defined(_MSC_VER) || defined(DOXYGEN_RUNNING)
129#ifndef _INTPTR_T_DECLARED
130/** Signed interger type capable of holding a pointer value, very useful for casting. */
131typedef __intptr_t intptr_t;
132/** Unsigned interger type capable of holding a pointer value, very useful for casting. */
133typedef __uintptr_t uintptr_t;
134#define _INTPTR_T_DECLARED
135#endif
136#endif /* !_MSC_VER || DOXYGEN_RUNNING */
137
138#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
139
140#define INT8_C(c) (c)
141#define INT16_C(c) (c)
142#define INT32_C(c) (c)
143#define INT64_C(c) (c ## LL)
144
145#define UINT8_C(c) (c)
146#define UINT16_C(c) (c)
147#define UINT32_C(c) (c ## U)
148#define UINT64_C(c) (c ## ULL)
149
150#define INTMAX_C(c) (c ## LL)
151#define UINTMAX_C(c) (c ## ULL)
152
153#define INT8_MIN (-0x7f-1)
154#define INT16_MIN (-0x7fff-1)
155#define INT32_MIN (-0x7fffffff-1)
156#define INT64_MIN (-0x7fffffffffffffffLL-1)
157
158#define INT8_MAX 0x7f
159#define INT16_MAX 0x7fff
160#define INT32_MAX 0x7fffffff
161#define INT64_MAX 0x7fffffffffffffffLL
162
163#define UINT8_MAX 0xff
164#define UINT16_MAX 0xffff
165#define UINT32_MAX 0xffffffffU
166#define UINT64_MAX 0xffffffffffffffffULL
167
168#endif /* !C++ || __STDC_CONSTANT_MACROS */
169
170#endif /* ! have usable stdint.h */
171
172#endif
173
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