e3802135be8203db525ce44af4ea1b567df9dbaf
[profile/ivi/mesa.git] / include / c99 / stdint.h
1 /**************************************************************************
2  *
3  * Copyright 2007-2010 VMware, Inc.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20  * USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * The above copyright notice and this permission notice (including the
23  * next paragraph) shall be included in all copies or substantial portions
24  * of the Software.
25  *
26  **************************************************************************/
27
28 /*
29  * stdint.h --
30  *
31  *    Portable subset of C99's stdint.h.
32  *
33  *    At the moment it only supports MSVC, given all other mainstream compilers
34  *    already support C99. If this is necessary for other compilers then it
35  *    might be worth to replace this with
36  *    http://www.azillionmonkeys.com/qed/pstdint.h.
37  */
38
39 #ifndef _STDINT_H_
40 #define _STDINT_H_
41
42
43 #ifndef INT8_MAX
44 #define INT8_MAX           127
45 #endif
46 #ifndef INT8_MIN
47 #define INT8_MIN           -128
48 #endif
49 #ifndef UINT8_MAX
50 #define UINT8_MAX          255
51 #endif
52 #ifndef INT16_MAX
53 #define INT16_MAX          32767
54 #endif
55 #ifndef INT16_MIN
56 #define INT16_MIN          -32768
57 #endif
58 #ifndef UINT16_MAX
59 #define UINT16_MAX         65535
60 #endif
61 #ifndef INT32_MAX
62 #define INT32_MAX          2147483647
63 #endif
64 #ifndef INT32_MIN
65 #define INT32_MIN          -2147483648
66 #endif
67 #ifndef UINT32_MAX
68 #define UINT32_MAX         4294967295U
69 #endif
70
71 #ifndef INT8_C
72 #define INT8_C(__val)     __val
73 #endif
74 #ifndef UINT8_C
75 #define UINT8_C(__val)    __val
76 #endif
77 #ifndef INT16_C
78 #define INT16_C(__val)    __val
79 #endif
80 #ifndef UINT16_C
81 #define UINT16_C(__val)   __val
82 #endif
83 #ifndef INT32_C
84 #define INT32_C(__val)    __val
85 #endif
86 #ifndef UINT32_C
87 #define UINT32_C(__val)   __val##U
88 #endif
89
90
91 #if defined(_MSC_VER)
92
93 typedef __int8             int8_t;
94 typedef unsigned __int8    uint8_t;
95 typedef __int16            int16_t;
96 typedef unsigned __int16   uint16_t;
97 #ifndef __eglplatform_h_
98 typedef __int32            int32_t;
99 #endif
100 typedef unsigned __int32   uint32_t;
101 typedef __int64            int64_t;
102 typedef unsigned __int64   uint64_t;
103
104 #if defined(_WIN64)
105 typedef __int64            intptr_t;
106 typedef unsigned __int64   uintptr_t;
107 #else
108 typedef __int32            intptr_t;
109 typedef unsigned __int32   uintptr_t;
110 #endif
111
112 #define INT64_C(__val)    __val##i64
113 #define UINT64_C(__val)   __val##ui64
114
115 #else
116 #error "Unsupported compiler"
117 #endif
118
119 #endif /* _STDINT_H_ */