LLVM API Documentation
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 functinons. *| 00020 |* *| 00021 |*===----------------------------------------------------------------------===*/ 00022 00023 /* Please leave this file C-compatible. */ 00024 00025 #ifndef SUPPORT_DATATYPES_H 00026 #define SUPPORT_DATATYPES_H 00027 00028 #define HAVE_SYS_TYPES_H 1 00029 #define HAVE_INTTYPES_H 1 00030 #define HAVE_STDINT_H 1 00031 #define HAVE_UINT64_T 1 00032 /* #undef HAVE_U_INT64_T */ 00033 00034 #ifdef __cplusplus 00035 #include <cmath> 00036 #else 00037 #include <math.h> 00038 #endif 00039 00040 #ifndef _MSC_VER 00041 00042 /* Note that this header's correct operation depends on __STDC_LIMIT_MACROS 00043 being defined. We would define it here, but in order to prevent Bad Things 00044 happening when system headers or C++ STL headers include stdint.h before we 00045 define it here, we define it on the g++ command line (in Makefile.rules). */ 00046 #if !defined(__STDC_LIMIT_MACROS) 00047 # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h" 00048 #endif 00049 00050 #if !defined(__STDC_CONSTANT_MACROS) 00051 # error "Must #define __STDC_CONSTANT_MACROS before " \ 00052 "#including Support/DataTypes.h" 00053 #endif 00054 00055 /* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */ 00056 #ifdef HAVE_SYS_TYPES_H 00057 #include <sys/types.h> 00058 #endif 00059 00060 #ifdef HAVE_INTTYPES_H 00061 #include <inttypes.h> 00062 #endif 00063 00064 #ifdef HAVE_STDINT_H 00065 #include <stdint.h> 00066 #endif 00067 00068 #ifdef _AIX 00069 #include "llvm/Support/AIXDataTypesFix.h" 00070 #endif 00071 00072 /* Handle incorrect definition of uint64_t as u_int64_t */ 00073 #ifndef HAVE_UINT64_T 00074 #ifdef HAVE_U_INT64_T 00075 typedef u_int64_t uint64_t; 00076 #else 00077 # error "Don't have a definition for uint64_t on this platform" 00078 #endif 00079 #endif 00080 00081 #ifdef _OpenBSD_ 00082 #define INT8_MAX 127 00083 #define INT8_MIN -128 00084 #define UINT8_MAX 255 00085 #define INT16_MAX 32767 00086 #define INT16_MIN -32768 00087 #define UINT16_MAX 65535 00088 #define INT32_MAX 2147483647 00089 #define INT32_MIN -2147483648 00090 #define UINT32_MAX 4294967295U 00091 #endif 00092 00093 #else /* _MSC_VER */ 00094 /* Visual C++ doesn't provide standard integer headers, but it does provide 00095 built-in data types. */ 00096 #include <stdlib.h> 00097 #include <stddef.h> 00098 #include <sys/types.h> 00099 typedef __int64 int64_t; 00100 typedef unsigned __int64 uint64_t; 00101 typedef signed int int32_t; 00102 typedef unsigned int uint32_t; 00103 typedef short int16_t; 00104 typedef unsigned short uint16_t; 00105 typedef signed char int8_t; 00106 typedef unsigned char uint8_t; 00107 typedef signed int ssize_t; 00108 #define INT8_MAX 127 00109 #define INT8_MIN -128 00110 #define UINT8_MAX 255 00111 #define INT16_MAX 32767 00112 #define INT16_MIN -32768 00113 #define UINT16_MAX 65535 00114 #define INT32_MAX 2147483647 00115 #define INT32_MIN -2147483648 00116 #define UINT32_MAX 4294967295U 00117 #define INT8_C(C) C 00118 #define UINT8_C(C) C 00119 #define INT16_C(C) C 00120 #define UINT16_C(C) C 00121 #define INT32_C(C) C 00122 #define UINT32_C(C) C ## U 00123 #define INT64_C(C) ((int64_t) C ## LL) 00124 #define UINT64_C(C) ((uint64_t) C ## ULL) 00125 #endif /* _MSC_VER */ 00126 00127 /* Set defaults for constants which we cannot find. */ 00128 #if !defined(INT64_MAX) 00129 # define INT64_MAX 9223372036854775807LL 00130 #endif 00131 #if !defined(INT64_MIN) 00132 # define INT64_MIN ((-INT64_MAX)-1) 00133 #endif 00134 #if !defined(UINT64_MAX) 00135 # define UINT64_MAX 0xffffffffffffffffULL 00136 #endif 00137 00138 #if __GNUC__ > 3 00139 #define END_WITH_NULL __attribute__((sentinel)) 00140 #else 00141 #define END_WITH_NULL 00142 #endif 00143 00144 #ifndef HUGE_VALF 00145 #define HUGE_VALF (float)HUGE_VAL 00146 #endif 00147 00148 #endif /* SUPPORT_DATATYPES_H */