LLVM API Documentation

Support/DataTypes.h
Go to the documentation of this file.
00001 /* include/llvm/Support/DataTypes.h.  Generated from DataTypes.h.in by configure.  */
00002 /*===-- include/Support/DataTypes.h - Define fixed size types -----*- C -*-===*\
00003 |*                                                                            *|
00004 |*                     The LLVM Compiler Infrastructure                       *|
00005 |*                                                                            *|
00006 |* This file is distributed under the University of Illinois Open Source      *|
00007 |* License. See LICENSE.TXT for details.                                      *|
00008 |*                                                                            *|
00009 |*===----------------------------------------------------------------------===*|
00010 |*                                                                            *|
00011 |* This file contains definitions to figure out the size of _HOST_ data types.*|
00012 |* This file is important because different host OS's define different macros,*|
00013 |* which makes portability tough.  This file exports the following            *|
00014 |* definitions:                                                               *|
00015 |*                                                                            *|
00016 |*   [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
00017 |*   [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values.     *|
00018 |*                                                                            *|
00019 |* No library is required when using these functions.                         *|
00020 |*                                                                            *|
00021 |*===----------------------------------------------------------------------===*/
00022 
00023 /* Please leave this file C-compatible. */
00024 
00025 /* Please keep this file in sync with DataTypes.h.cmake */
00026 
00027 #ifndef SUPPORT_DATATYPES_H
00028 #define SUPPORT_DATATYPES_H
00029 
00030 #define HAVE_SYS_TYPES_H 1
00031 #define HAVE_INTTYPES_H 1
00032 #define HAVE_STDINT_H 1
00033 #define HAVE_UINT64_T 1
00034 /* #undef HAVE_U_INT64_T */
00035 
00036 #ifdef __cplusplus
00037 #include <cmath>
00038 #else
00039 #include <math.h>
00040 #endif
00041 
00042 #ifndef _MSC_VER
00043 
00044 /* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
00045    being defined.  We would define it here, but in order to prevent Bad Things
00046    happening when system headers or C++ STL headers include stdint.h before we
00047    define it here, we define it on the g++ command line (in Makefile.rules). */
00048 #if !defined(__STDC_LIMIT_MACROS)
00049 # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
00050 #endif
00051 
00052 #if !defined(__STDC_CONSTANT_MACROS)
00053 # error "Must #define __STDC_CONSTANT_MACROS before " \
00054         "#including Support/DataTypes.h"
00055 #endif
00056 
00057 /* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
00058 #ifdef HAVE_SYS_TYPES_H
00059 #include <sys/types.h>
00060 #endif
00061 
00062 #ifdef HAVE_INTTYPES_H
00063 #include <inttypes.h>
00064 #endif
00065 
00066 #ifdef HAVE_STDINT_H
00067 #include <stdint.h>
00068 #endif
00069 
00070 #ifdef _AIX
00071 #include "llvm/Support/AIXDataTypesFix.h"
00072 #endif
00073 
00074 /* Handle incorrect definition of uint64_t as u_int64_t */
00075 #ifndef HAVE_UINT64_T
00076 #ifdef HAVE_U_INT64_T
00077 typedef u_int64_t uint64_t;
00078 #else
00079 # error "Don't have a definition for uint64_t on this platform"
00080 #endif
00081 #endif
00082 
00083 #else /* _MSC_VER */
00084 /* Visual C++ doesn't provide standard integer headers, but it does provide
00085    built-in data types. */
00086 #include <stdlib.h>
00087 #include <stddef.h>
00088 #include <sys/types.h>
00089 #ifdef __cplusplus
00090 #include <cmath>
00091 #else
00092 #include <math.h>
00093 #endif
00094 typedef __int64 int64_t;
00095 typedef unsigned __int64 uint64_t;
00096 typedef signed int int32_t;
00097 typedef unsigned int uint32_t;
00098 typedef short int16_t;
00099 typedef unsigned short uint16_t;
00100 typedef signed char int8_t;
00101 typedef unsigned char uint8_t;
00102 typedef signed int ssize_t;
00103 #ifndef INT8_MAX
00104 # define INT8_MAX 127
00105 #endif
00106 #ifndef INT8_MIN
00107 # define INT8_MIN -128
00108 #endif
00109 #ifndef UINT8_MAX
00110 # define UINT8_MAX 255
00111 #endif
00112 #ifndef INT16_MAX
00113 # define INT16_MAX 32767
00114 #endif
00115 #ifndef INT16_MIN
00116 # define INT16_MIN -32768
00117 #endif
00118 #ifndef UINT16_MAX
00119 # define UINT16_MAX 65535
00120 #endif
00121 #ifndef INT32_MAX
00122 # define INT32_MAX 2147483647
00123 #endif
00124 #ifndef INT32_MIN
00125 /* MSC treats -2147483648 as -(2147483648U). */
00126 # define INT32_MIN (-INT32_MAX - 1)
00127 #endif
00128 #ifndef UINT32_MAX
00129 # define UINT32_MAX 4294967295U
00130 #endif
00131 /* Certain compatibility updates to VC++ introduce the `cstdint'
00132  * header, which defines the INT*_C macros. On default installs they
00133  * are absent. */
00134 #ifndef INT8_C
00135 # define INT8_C(C)   C##i8
00136 #endif
00137 #ifndef UINT8_C
00138 # define UINT8_C(C)  C##ui8
00139 #endif
00140 #ifndef INT16_C
00141 # define INT16_C(C)  C##i16
00142 #endif
00143 #ifndef UINT16_C
00144 # define UINT16_C(C) C##ui16
00145 #endif
00146 #ifndef INT32_C
00147 # define INT32_C(C)  C##i32
00148 #endif
00149 #ifndef UINT32_C
00150 # define UINT32_C(C) C##ui32
00151 #endif
00152 #ifndef INT64_C
00153 # define INT64_C(C)  C##i64
00154 #endif
00155 #ifndef UINT64_C
00156 # define UINT64_C(C) C##ui64
00157 #endif
00158 
00159 #ifndef PRId64
00160 # define PRId64 "I64d"
00161 #endif
00162 #ifndef PRIi64
00163 # define PRIi64 "I64i"
00164 #endif
00165 #ifndef PRIo64
00166 # define PRIo64 "I64o"
00167 #endif
00168 #ifndef PRIu64
00169 # define PRIu64 "I64u"
00170 #endif
00171 #ifndef PRIx64
00172 # define PRIx64 "I64x"
00173 #endif
00174 #ifndef PRIX64
00175 # define PRIX64 "I64X"
00176 #endif
00177 
00178 #endif /* _MSC_VER */
00179 
00180 /* Set defaults for constants which we cannot find. */
00181 #if !defined(INT64_MAX)
00182 # define INT64_MAX 9223372036854775807LL
00183 #endif
00184 #if !defined(INT64_MIN)
00185 # define INT64_MIN ((-INT64_MAX)-1)
00186 #endif
00187 #if !defined(UINT64_MAX)
00188 # define UINT64_MAX 0xffffffffffffffffULL
00189 #endif
00190 
00191 #if __GNUC__ > 3
00192 #define END_WITH_NULL __attribute__((sentinel))
00193 #else
00194 #define END_WITH_NULL
00195 #endif
00196 
00197 #ifndef HUGE_VALF
00198 #define HUGE_VALF (float)HUGE_VAL
00199 #endif
00200 
00201 #endif  /* SUPPORT_DATATYPES_H */