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_INTTYPES_H 1
00031 #define HAVE_STDINT_H 1
00032 #define HAVE_UINT64_T 1
00033 /* #undef HAVE_U_INT64_T */
00034 
00035 #ifdef __cplusplus
00036 #include <cmath>
00037 #else
00038 #include <math.h>
00039 #endif
00040 
00041 #ifndef _MSC_VER
00042 
00043 /* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
00044    being defined.  We would define it here, but in order to prevent Bad Things
00045    happening when system headers or C++ STL headers include stdint.h before we
00046    define it here, we define it on the g++ command line (in Makefile.rules). */
00047 #if !defined(__STDC_LIMIT_MACROS)
00048 # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
00049 #endif
00050 
00051 #if !defined(__STDC_CONSTANT_MACROS)
00052 # error "Must #define __STDC_CONSTANT_MACROS before " \
00053         "#including Support/DataTypes.h"
00054 #endif
00055 
00056 /* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
00057 #include <sys/types.h>
00058 
00059 #ifdef HAVE_INTTYPES_H
00060 #include <inttypes.h>
00061 #endif
00062 
00063 #ifdef HAVE_STDINT_H
00064 #include <stdint.h>
00065 #endif
00066 
00067 #ifdef _AIX
00068 #include "llvm/Support/AIXDataTypesFix.h"
00069 #endif
00070 
00071 /* Handle incorrect definition of uint64_t as u_int64_t */
00072 #ifndef HAVE_UINT64_T
00073 #ifdef HAVE_U_INT64_T
00074 typedef u_int64_t uint64_t;
00075 #else
00076 # error "Don't have a definition for uint64_t on this platform"
00077 #endif
00078 #endif
00079 
00080 #else /* _MSC_VER */
00081 /* Visual C++ doesn't provide standard integer headers, but it does provide
00082    built-in data types. */
00083 #include <stdlib.h>
00084 #include <stddef.h>
00085 #include <sys/types.h>
00086 #ifdef __cplusplus
00087 #include <cmath>
00088 #else
00089 #include <math.h>
00090 #endif
00091 typedef __int64 int64_t;
00092 typedef unsigned __int64 uint64_t;
00093 typedef signed int int32_t;
00094 typedef unsigned int uint32_t;
00095 typedef short int16_t;
00096 typedef unsigned short uint16_t;
00097 typedef signed char int8_t;
00098 typedef unsigned char uint8_t;
00099 #if defined(_WIN64)
00100   typedef signed __int64 ssize_t;
00101 #else
00102   typedef signed int ssize_t;
00103 #endif
00104 
00105 #ifndef INT8_MAX
00106 # define INT8_MAX 127
00107 #endif
00108 #ifndef INT8_MIN
00109 # define INT8_MIN -128
00110 #endif
00111 #ifndef UINT8_MAX
00112 # define UINT8_MAX 255
00113 #endif
00114 #ifndef INT16_MAX
00115 # define INT16_MAX 32767
00116 #endif
00117 #ifndef INT16_MIN
00118 # define INT16_MIN -32768
00119 #endif
00120 #ifndef UINT16_MAX
00121 # define UINT16_MAX 65535
00122 #endif
00123 #ifndef INT32_MAX
00124 # define INT32_MAX 2147483647
00125 #endif
00126 #ifndef INT32_MIN
00127 /* MSC treats -2147483648 as -(2147483648U). */
00128 # define INT32_MIN (-INT32_MAX - 1)
00129 #endif
00130 #ifndef UINT32_MAX
00131 # define UINT32_MAX 4294967295U
00132 #endif
00133 /* Certain compatibility updates to VC++ introduce the `cstdint'
00134  * header, which defines the INT*_C macros. On default installs they
00135  * are absent. */
00136 #ifndef INT8_C
00137 # define INT8_C(C)   C##i8
00138 #endif
00139 #ifndef UINT8_C
00140 # define UINT8_C(C)  C##ui8
00141 #endif
00142 #ifndef INT16_C
00143 # define INT16_C(C)  C##i16
00144 #endif
00145 #ifndef UINT16_C
00146 # define UINT16_C(C) C##ui16
00147 #endif
00148 #ifndef INT32_C
00149 # define INT32_C(C)  C##i32
00150 #endif
00151 #ifndef UINT32_C
00152 # define UINT32_C(C) C##ui32
00153 #endif
00154 #ifndef INT64_C
00155 # define INT64_C(C)  C##i64
00156 #endif
00157 #ifndef UINT64_C
00158 # define UINT64_C(C) C##ui64
00159 #endif
00160 
00161 #ifndef PRId64
00162 # define PRId64 "I64d"
00163 #endif
00164 #ifndef PRIi64
00165 # define PRIi64 "I64i"
00166 #endif
00167 #ifndef PRIo64
00168 # define PRIo64 "I64o"
00169 #endif
00170 #ifndef PRIu64
00171 # define PRIu64 "I64u"
00172 #endif
00173 #ifndef PRIx64
00174 # define PRIx64 "I64x"
00175 #endif
00176 #ifndef PRIX64
00177 # define PRIX64 "I64X"
00178 #endif
00179 
00180 #endif /* _MSC_VER */
00181 
00182 /* Set defaults for constants which we cannot find. */
00183 #if !defined(INT64_MAX)
00184 # define INT64_MAX 9223372036854775807LL
00185 #endif
00186 #if !defined(INT64_MIN)
00187 # define INT64_MIN ((-INT64_MAX)-1)
00188 #endif
00189 #if !defined(UINT64_MAX)
00190 # define UINT64_MAX 0xffffffffffffffffULL
00191 #endif
00192 
00193 #if __GNUC__ > 3
00194 #define END_WITH_NULL __attribute__((sentinel))
00195 #else
00196 #define END_WITH_NULL
00197 #endif
00198 
00199 #ifndef HUGE_VALF
00200 #define HUGE_VALF (float)HUGE_VAL
00201 #endif
00202 
00203 #endif  /* SUPPORT_DATATYPES_H */