1 /*===-- include/System/DataTypes.h - Define fixed size types -----*- C -*-===*\
3 |* The LLVM Compiler Infrastructure *|
5 |* This file is distributed under the University of Illinois Open Source *|
6 |* License. See LICENSE.TXT for details. *|
8 |*===----------------------------------------------------------------------===*|
10 |* This file contains definitions to figure out the size of _HOST_ data types.*|
11 |* This file is important because different host OS's define different macros,*|
12 |* which makes portability tough. This file exports the following *|
15 |* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
16 |* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
18 |* No library is required when using these functions. *|
20 |*===----------------------------------------------------------------------===*/
22 /* Please leave this file C-compatible. */
24 #ifndef SUPPORT_DATATYPES_H
25 #define SUPPORT_DATATYPES_H
27 #undef HAVE_SYS_TYPES_H
28 #undef HAVE_INTTYPES_H
39 /* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
40 being defined. We would define it here, but in order to prevent Bad Things
41 happening when system headers or C++ STL headers include stdint.h before we
42 define it here, we define it on the g++ command line (in Makefile.rules). */
43 #if !defined(__STDC_LIMIT_MACROS)
44 # error "Must #define __STDC_LIMIT_MACROS before #including System/DataTypes.h"
47 #if !defined(__STDC_CONSTANT_MACROS)
48 # error "Must #define __STDC_CONSTANT_MACROS before " \
49 "#including System/DataTypes.h"
52 /* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
53 #ifdef HAVE_SYS_TYPES_H
54 #include <sys/types.h>
57 #ifdef HAVE_INTTYPES_H
66 #include "llvm/System/AIXDataTypesFix.h"
69 /* Handle incorrect definition of uint64_t as u_int64_t */
72 typedef u_int64_t uint64_t;
74 # error "Don't have a definition for uint64_t on this platform"
82 #define INT16_MAX 32767
83 #define INT16_MIN -32768
84 #define UINT16_MAX 65535
85 #define INT32_MAX 2147483647
86 #define INT32_MIN -2147483648
87 #define UINT32_MAX 4294967295U
90 /* Set defaults for constants which we cannot find. */
91 #if !defined(INT64_MAX)
92 # define INT64_MAX 9223372036854775807LL
94 #if !defined(INT64_MIN)
95 # define INT64_MIN ((-INT64_MAX)-1)
97 #if !defined(UINT64_MAX)
98 # define UINT64_MAX 0xffffffffffffffffULL
102 #define END_WITH_NULL __attribute__((sentinel))
104 #define END_WITH_NULL
108 #define HUGE_VALF (float)HUGE_VAL
111 #endif /* SUPPORT_DATATYPES_H */