1 /*===-- include/Support/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 /* Please keep this file in sync with DataTypes.h.cmake */
26 #ifndef SUPPORT_DATATYPES_H
27 #define SUPPORT_DATATYPES_H
29 #undef HAVE_INTTYPES_H
40 #ifdef HAVE_INTTYPES_H
47 #error "Compiler must provide an implementation of stdint.h"
52 /* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
53 being defined. We would define it here, but in order to prevent Bad Things
54 happening when system headers or C++ STL headers include stdint.h before we
55 define it here, we define it on the g++ command line (in Makefile.rules). */
56 #if !defined(__STDC_LIMIT_MACROS)
57 # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
60 #if !defined(__STDC_CONSTANT_MACROS)
61 # error "Must #define __STDC_CONSTANT_MACROS before " \
62 "#including Support/DataTypes.h"
65 /* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
66 #include <sys/types.h>
69 #include "llvm/Support/AIXDataTypesFix.h"
72 /* Handle incorrect definition of uint64_t as u_int64_t */
75 typedef u_int64_t uint64_t;
77 # error "Don't have a definition for uint64_t on this platform"
84 #include <sys/types.h>
92 typedef signed __int64 ssize_t;
94 typedef signed int ssize_t;
97 #ifndef HAVE_INTTYPES_H
100 #define PRIo64 "I64o"
101 #define PRIu64 "I64u"
102 #define PRIx64 "I64x"
103 #define PRIX64 "I64X"
104 #endif /* HAVE_INTTYPES_H */
106 #endif /* _MSC_VER */
108 /* Set defaults for constants which we cannot find. */
109 #if !defined(INT64_MAX)
110 # define INT64_MAX 9223372036854775807LL
112 #if !defined(INT64_MIN)
113 # define INT64_MIN ((-INT64_MAX)-1)
115 #if !defined(UINT64_MAX)
116 # define UINT64_MAX 0xffffffffffffffffULL
120 #define END_WITH_NULL __attribute__((sentinel))
122 #define END_WITH_NULL
126 #define HUGE_VALF (float)HUGE_VAL
129 #endif /* SUPPORT_DATATYPES_H */