1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef PHP_STDINT_H
20 #define PHP_STDINT_H
21
22
23
24
25
26
27
28
29
30
31
32 #ifdef __cplusplus
33 # ifndef __STDC_LIMIT_MACROS
34 # define __STDC_LIMIT_MACROS
35 # endif
36 # ifndef __STDC_CONSTANT_MACROS
37 # define __STDC_CONSTANT_MACROS
38 # endif
39 #endif
40
41 #if defined(_MSC_VER)
42
43
44
45
46
47 # if !defined(_STDINT)
48 # define _STDINT
49 # include "win32/php_stdint.h"
50 # include "win32/php_inttypes.h"
51 # endif
52 # define HAVE_INT8_T 1
53 # define HAVE_UINT8_T 1
54 # define HAVE_INT16_T 1
55 # define HAVE_UINT16_T 1
56 # define HAVE_INT32_T 1
57 # define HAVE_UINT32_T 1
58 # define HAVE_INT64_T 1
59 # define HAVE_UINT64_T 1
60 #else
61
62 #include "php_config.h"
63
64 #if HAVE_SYS_TYPES_H
65 # include <sys/types.h>
66 #endif
67
68 #if HAVE_INTTYPES_H
69 # include <inttypes.h>
70 #endif
71
72 #if HAVE_STDINT_H
73 # include <stdint.h>
74 #endif
75
76 #ifndef HAVE_INT8_T
77 # ifdef HAVE_INT8
78 typedef int8 int8_t;
79 # else
80 typedef signed char int8_t;
81 # endif
82 #endif
83
84 #ifndef INT8_C
85 # define INT8_C(c) c
86 #endif
87
88 #ifndef HAVE_UINT8_T
89 # ifdef HAVE_UINT8
90 typedef uint8 uint8_t
91 # elif HAVE_U_INT8_T
92 typedef u_int8_t uint8_t;
93 # else
94 typedef unsigned char uint8_t;
95 # endif
96 #endif
97
98 #ifndef UINT8_C
99 # define UINT8_C(c) c
100 #endif
101
102 #ifndef HAVE_INT16_T
103 # ifdef HAVE_INT16
104 typedef int16 int16_t;
105 # elif SIZEOF_SHORT >= 2
106 typedef signed short int16_t;
107 # else
108 # error "No suitable 16bit integer type found"
109 # endif
110 #endif
111
112 #ifndef INT16_C
113 # define INT16_C(c) c
114 #endif
115
116 #ifndef HAVE_UINT16_T
117 # ifdef HAVE_UINT16
118 typedef uint16 uint16_t
119 # elif HAVE_U_INT16_T
120 typedef u_int16_t uint16_t;
121 # elif SIZEOF_SHORT >= 2
122 typedef unsigned short uint16_t;
123 # else
124 # error "No suitable 16bit integer type found"
125 # endif
126 #endif
127
128 #ifndef UINT16_C
129 # define UINT16_C(c) c
130 #endif
131
132 #ifndef HAVE_INT32_T
133 # ifdef HAVE_INT32
134 typedef int32 int32_t;
135 # elif SIZEOF_INT >= 4
136 typedef int int32_t;
137 # elif SIZEOF_LONG >= 4
138 typedef long int32_t;
139 # else
140 # error "No suitable 32bit integer type found"
141 # endif
142 #endif
143
144 #ifndef INT32_C
145 # define INT32_C(c) c
146 #endif
147
148 #ifndef HAVE_UINT32_T
149 # ifdef HAVE_UINT32
150 typedef uint32 uint32_t
151 # elif HAVE_U_INT32_T
152 typedef u_int32_t uint32_t;
153 # elif SIZEOF_INT >= 4
154 typedef unsigned int uint32_t;
155 # elif SIZEOF_LONG >= 4
156 typedef unsigned long uint32_t;
157 # else
158 # error "No suitable 32bit integer type found"
159 # endif
160 #endif
161
162 #ifndef UINT32_C
163 # define UINT32_C(c) c ## U
164 #endif
165
166 #ifndef HAVE_INT64_T
167 # ifdef HAVE_INT64
168 typedef int64 int64_t;
169 # elif SIZEOF_INT >= 8
170 typedef int int64_t;
171 # elif SIZEOF_LONG >= 8
172 typedef long int64_t;
173 # elif SIZEOF_LONG_LONG >= 8
174 typedef long long int64_t;
175 # else
176 # error "No suitable 64bit integer type found"
177 # endif
178 #endif
179
180 #ifndef INT64_C
181 # if SIZEOF_INT >= 8
182 # define INT64_C(c) c
183 # elif SIZEOF_LONG >= 8
184 # define INT64_C(c) c ## L
185 # elif SIZEOF_LONG_LONG >= 8
186 # define INT64_C(c) c ## LL
187 # endif
188 #endif
189
190 #ifndef HAVE_UINT64_T
191 # ifdef HAVE_UINT64
192 typedef uint64 uint64_t
193 # elif HAVE_U_INT64_T
194 typedef u_int64_t uint64_t;
195 # elif SIZEOF_INT >= 8
196 typedef unsigned int uint64_t;
197 # elif SIZEOF_LONG >= 8
198 typedef unsigned long uint64_t;
199 # elif SIZEOF_LONG_LONG >= 8
200 typedef unsigned long long uint64_t;
201 # else
202 # error "No suitable 64bit integer type found"
203 # endif
204 #endif
205
206 #ifndef UINT64_C
207 # if SIZEOF_INT >= 8
208 # define UINT64_C(c) c ## U
209 # elif SIZEOF_LONG >= 8
210 # define UINT64_C(c) c ## UL
211 # elif SIZEOF_LONG_LONG >= 8
212 # define UINT64_C(c) c ## ULL
213 # endif
214 #endif
215
216 #endif
217 #endif
218
219
220
221
222
223
224
225
226