1/* include/llvm/Support/DataTypes.h.  Generated from DataTypes.h.in by configure.  */
2/*===-- include/Support/DataTypes.h - Define fixed size types -----*- C -*-===*\
3|*                                                                            *|
4|*                     The LLVM Compiler Infrastructure                       *|
5|*                                                                            *|
6|* This file is distributed under the University of Illinois Open Source      *|
7|* License. See LICENSE.TXT for details.                                      *|
8|*                                                                            *|
9|*===----------------------------------------------------------------------===*|
10|*                                                                            *|
11|* This file contains definitions to figure out the size of _HOST_ data types.*|
12|* This file is important because different host OS's define different macros,*|
13|* which makes portability tough.  This file exports the following            *|
14|* definitions:                                                               *|
15|*                                                                            *|
16|*   [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
17|*   [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values.     *|
18|*                                                                            *|
19|* No library is required when using these functions.                         *|
20|*                                                                            *|
21|*===----------------------------------------------------------------------===*/
22
23/* Please leave this file C-compatible. */
24
25/* Please keep this file in sync with DataTypes.h.cmake */
26
27#ifndef SUPPORT_DATATYPES_H
28#define SUPPORT_DATATYPES_H
29
30#define HAVE_SYS_TYPES_H 1
31#define HAVE_INTTYPES_H 1
32#define HAVE_STDINT_H 1
33#define HAVE_UINT64_T 1
34/* #undef HAVE_U_INT64_T */
35
36#ifdef __cplusplus
37#include <cmath>
38#else
39#include <math.h>
40#endif
41
42#ifndef _MSC_VER
43
44/* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
45   being defined.  We would define it here, but in order to prevent Bad Things
46   happening when system headers or C++ STL headers include stdint.h before we
47   define it here, we define it on the g++ command line (in Makefile.rules). */
48#if !defined(__STDC_LIMIT_MACROS)
49# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
50#endif
51
52#if !defined(__STDC_CONSTANT_MACROS)
53# error "Must #define __STDC_CONSTANT_MACROS before " \
54        "#including Support/DataTypes.h"
55#endif
56
57/* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
58#ifdef HAVE_SYS_TYPES_H
59#include <sys/types.h>
60#endif
61
62#ifdef HAVE_INTTYPES_H
63#include <inttypes.h>
64#endif
65
66#ifdef HAVE_STDINT_H
67#include <stdint.h>
68#endif
69
70#ifdef _AIX
71#include "llvm/Support/AIXDataTypesFix.h"
72#endif
73
74/* Handle incorrect definition of uint64_t as u_int64_t */
75#ifndef HAVE_UINT64_T
76#ifdef HAVE_U_INT64_T
77typedef u_int64_t uint64_t;
78#else
79# error "Don't have a definition for uint64_t on this platform"
80#endif
81#endif
82
83#ifdef _OpenBSD_
84#define INT8_MAX 127
85#define INT8_MIN -128
86#define UINT8_MAX 255
87#define INT16_MAX 32767
88#define INT16_MIN -32768
89#define UINT16_MAX 65535
90#define INT32_MAX 2147483647
91#define INT32_MIN -2147483648
92#define UINT32_MAX 4294967295U
93#endif
94
95#else /* _MSC_VER */
96/* Visual C++ doesn't provide standard integer headers, but it does provide
97   built-in data types. */
98#include <stdlib.h>
99#include <stddef.h>
100#include <sys/types.h>
101#ifdef __cplusplus
102#include <cmath>
103#else
104#include <math.h>
105#endif
106typedef __int64 int64_t;
107typedef unsigned __int64 uint64_t;
108typedef signed int int32_t;
109typedef unsigned int uint32_t;
110typedef short int16_t;
111typedef unsigned short uint16_t;
112typedef signed char int8_t;
113typedef unsigned char uint8_t;
114typedef signed int ssize_t;
115#ifndef INT8_MAX
116# define INT8_MAX 127
117#endif
118#ifndef INT8_MIN
119# define INT8_MIN -128
120#endif
121#ifndef UINT8_MAX
122# define UINT8_MAX 255
123#endif
124#ifndef INT16_MAX
125# define INT16_MAX 32767
126#endif
127#ifndef INT16_MIN
128# define INT16_MIN -32768
129#endif
130#ifndef UINT16_MAX
131# define UINT16_MAX 65535
132#endif
133#ifndef INT32_MAX
134# define INT32_MAX 2147483647
135#endif
136#ifndef INT32_MIN
137/* MSC treats -2147483648 as -(2147483648U). */
138# define INT32_MIN (-INT32_MAX - 1)
139#endif
140#ifndef UINT32_MAX
141# define UINT32_MAX 4294967295U
142#endif
143/* Certain compatibility updates to VC++ introduce the `cstdint'
144 * header, which defines the INT*_C macros. On default installs they
145 * are absent. */
146#ifndef INT8_C
147# define INT8_C(C)   C##i8
148#endif
149#ifndef UINT8_C
150# define UINT8_C(C)  C##ui8
151#endif
152#ifndef INT16_C
153# define INT16_C(C)  C##i16
154#endif
155#ifndef UINT16_C
156# define UINT16_C(C) C##ui16
157#endif
158#ifndef INT32_C
159# define INT32_C(C)  C##i32
160#endif
161#ifndef UINT32_C
162# define UINT32_C(C) C##ui32
163#endif
164#ifndef INT64_C
165# define INT64_C(C)  C##i64
166#endif
167#ifndef UINT64_C
168# define UINT64_C(C) C##ui64
169#endif
170
171#ifndef PRId64
172# define PRId64 "I64d"
173#endif
174#ifndef PRIi64
175# define PRIi64 "I64i"
176#endif
177#ifndef PRIo64
178# define PRIo64 "I64o"
179#endif
180#ifndef PRIu64
181# define PRIu64 "I64u"
182#endif
183#ifndef PRIx64
184# define PRIx64 "I64x"
185#endif
186#ifndef PRIX64
187# define PRIX64 "I64X"
188#endif
189
190#endif /* _MSC_VER */
191
192/* Set defaults for constants which we cannot find. */
193#if !defined(INT64_MAX)
194# define INT64_MAX 9223372036854775807LL
195#endif
196#if !defined(INT64_MIN)
197# define INT64_MIN ((-INT64_MAX)-1)
198#endif
199#if !defined(UINT64_MAX)
200# define UINT64_MAX 0xffffffffffffffffULL
201#endif
202
203#if __GNUC__ > 3
204#define END_WITH_NULL __attribute__((sentinel))
205#else
206#define END_WITH_NULL
207#endif
208
209#ifndef HUGE_VALF
210#define HUGE_VALF (float)HUGE_VAL
211#endif
212
213#endif  /* SUPPORT_DATATYPES_H */
214