VirtualBox

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

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

The Giant CDDL Dual-License Header Change.

  • 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 (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)
45# include <stdint.h>
46
47#else
48
49#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) || defined(IPRT_NO_CRT)
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#ifndef _MSC_VER
125#ifndef _INTPTR_T_DECLARED
126typedef __intptr_t intptr_t;
127typedef __uintptr_t uintptr_t;
128#define _INTPTR_T_DECLARED
129#endif
130#endif /* !_MSC_VER */
131
132#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
133
134#define INT8_C(c) (c)
135#define INT16_C(c) (c)
136#define INT32_C(c) (c)
137#define INT64_C(c) (c ## LL)
138
139#define UINT8_C(c) (c)
140#define UINT16_C(c) (c)
141#define UINT32_C(c) (c ## U)
142#define UINT64_C(c) (c ## ULL)
143
144#define INTMAX_C(c) (c ## LL)
145#define UINTMAX_C(c) (c ## ULL)
146
147#define INT8_MIN (-0x7f-1)
148#define INT16_MIN (-0x7fff-1)
149#define INT32_MIN (-0x7fffffff-1)
150#define INT64_MIN (-0x7fffffffffffffffLL-1)
151
152#define INT8_MAX 0x7f
153#define INT16_MAX 0x7fff
154#define INT32_MAX 0x7fffffff
155#define INT64_MAX 0x7fffffffffffffffLL
156
157#define UINT8_MAX 0xff
158#define UINT16_MAX 0xffff
159#define UINT32_MAX 0xffffffffU
160#define UINT64_MAX 0xffffffffffffffffULL
161
162#endif /* !C++ || __STDC_CONSTANT_MACROS */
163
164#endif /* ! have usable stdint.h */
165
166#endif
167
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