VirtualBox

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

Last change on this file since 2436 was 331, checked in by vboxsync, 18 years ago

Bool and AMD64 hacking.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
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 */
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
58typedef long long __int64_t;
59typedef 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! */
64typedef signed long __intptr_t;
65typedef unsigned long __uintptr_t;
66#else
67typedef __int64_t __intptr_t;
68typedef __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
75typedef __int8_t int8_t;
76#define _INT8_T_DECLARED
77#endif
78
79#ifndef _INT16_T_DECLARED
80typedef __int16_t int16_t;
81#define _INT16_T_DECLARED
82#endif
83
84#ifndef _INT32_T_DECLARED
85typedef __int32_t int32_t;
86#define _INT32_T_DECLARED
87#endif
88
89#ifndef _INT64_T_DECLARED
90typedef __int64_t int64_t;
91#define _INT64_T_DECLARED
92#endif
93
94#ifndef _UINT8_T_DECLARED
95typedef __uint8_t uint8_t;
96#define _UINT8_T_DECLARED
97#endif
98
99#ifndef _UINT16_T_DECLARED
100typedef __uint16_t uint16_t;
101#define _UINT16_T_DECLARED
102#endif
103
104#ifndef _UINT32_T_DECLARED
105typedef __uint32_t uint32_t;
106#define _UINT32_T_DECLARED
107#endif
108
109#ifndef _UINT64_T_DECLARED
110typedef __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
118typedef __intptr_t intptr_t;
119typedef __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
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