VirtualBox

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

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

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 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 *
17 * This code is based on:
18 *
19 * Based on various FreeBSD 5.2 headers.
20 *
21 */
22
23#ifndef ___iprt_stdint_h
24#define ___iprt_stdint_h
25
26#ifndef __STDC_CONSTANT_MACROS
27# define __STDC_CONSTANT_MACROS
28#endif
29#ifndef __STDC_LIMIT_MACROS
30# define __STDC_LIMIT_MACROS
31#endif
32
33#include <iprt/cdefs.h>
34
35#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) && !defined(_MSC_VER) && !defined(__IBMC__) && !defined(__IBMCPP__) && !defined(IPRT_NO_CRT)
36# include <stdint.h>
37
38#else
39
40#if !(defined(RT_OS_LINUX) && defined(__KERNEL__)) || defined(IPRT_NO_CRT)
41/* machine specific */
42typedef signed char __int8_t;
43typedef unsigned char __uint8_t;
44typedef short __int16_t;
45typedef unsigned short __uint16_t;
46typedef int __int32_t;
47typedef unsigned int __uint32_t;
48
49# ifdef _MSC_VER
50typedef _int64 __int64_t;
51typedef unsigned _int64 __uint64_t;
52# else
53# if defined(__IBMC__) || defined(__IBMCPP__) /* assume VAC308 without long long. */
54typedef struct { __uint32_t lo,hi; } __int64_t, __uint64_t;
55# else
56typedef long long __int64_t;
57typedef unsigned long long __uint64_t;
58# endif
59# endif
60#endif /* !linux kernel and more */
61
62#if ARCH_BITS == 32 || defined(RT_OS_LINUX) || defined(RT_OS_FREEBSD)
63typedef signed long __intptr_t;
64typedef unsigned long __uintptr_t;
65#else
66typedef __int64_t __intptr_t;
67typedef __uint64_t __uintptr_t;
68#endif
69
70
71/* the stuff we use */
72#if (!defined(RT_OS_LINUX) && !defined(__KERNEL__)) || defined(IPRT_NO_CRT)
73#ifndef _INT8_T_DECLARED
74typedef __int8_t int8_t;
75#define _INT8_T_DECLARED
76#endif
77
78#ifndef _INT16_T_DECLARED
79typedef __int16_t int16_t;
80#define _INT16_T_DECLARED
81#endif
82
83#ifndef _INT32_T_DECLARED
84typedef __int32_t int32_t;
85#define _INT32_T_DECLARED
86#endif
87
88#ifndef _INT64_T_DECLARED
89typedef __int64_t int64_t;
90#define _INT64_T_DECLARED
91#endif
92
93#ifndef _UINT8_T_DECLARED
94typedef __uint8_t uint8_t;
95#define _UINT8_T_DECLARED
96#endif
97
98#ifndef _UINT16_T_DECLARED
99typedef __uint16_t uint16_t;
100#define _UINT16_T_DECLARED
101#endif
102
103#ifndef _UINT32_T_DECLARED
104typedef __uint32_t uint32_t;
105#define _UINT32_T_DECLARED
106#endif
107
108#ifndef _UINT64_T_DECLARED
109typedef __uint64_t uint64_t;
110#define _UINT64_T_DECLARED
111#endif
112
113#endif /* !linux kernel || no-crt */
114
115#ifndef _MSC_VER
116#ifndef _INTPTR_T_DECLARED
117typedef __intptr_t intptr_t;
118typedef __uintptr_t uintptr_t;
119#define _INTPTR_T_DECLARED
120#endif
121#endif /* !_MSC_VER */
122
123#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
124
125#define INT8_C(c) (c)
126#define INT16_C(c) (c)
127#define INT32_C(c) (c)
128#define INT64_C(c) (c ## LL)
129
130#define UINT8_C(c) (c)
131#define UINT16_C(c) (c)
132#define UINT32_C(c) (c ## U)
133#define UINT64_C(c) (c ## ULL)
134
135#define INTMAX_C(c) (c ## LL)
136#define UINTMAX_C(c) (c ## ULL)
137
138#define INT8_MIN (-0x7f-1)
139#define INT16_MIN (-0x7fff-1)
140#define INT32_MIN (-0x7fffffff-1)
141#define INT64_MIN (-0x7fffffffffffffffLL-1)
142
143#define INT8_MAX 0x7f
144#define INT16_MAX 0x7fff
145#define INT32_MAX 0x7fffffff
146#define INT64_MAX 0x7fffffffffffffffLL
147
148#define UINT8_MAX 0xff
149#define UINT16_MAX 0xffff
150#define UINT32_MAX 0xffffffffU
151#define UINT64_MAX 0xffffffffffffffffULL
152
153#endif /* !C++ || __STDC_CONSTANT_MACROS */
154
155#endif /* ! have usable stdint.h */
156
157#endif
158
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