LLVM API Documentation

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