2 /*===-- include/Support/DataTypes.h - Define fixed size types -----*- C -*-===*\
4 |* The LLVM Compiler Infrastructure *|
6 |* This file is distributed under the University of Illinois Open Source *|
7 |* License. See LICENSE.TXT for details. *|
9 |*===----------------------------------------------------------------------===*|
11 |* This file contains definitions to figure out the size of _HOST_ data types.*|
12 |* This file is important because different host OS's define different macros,*|
13 |* which makes portability tough. This file exports the following *|
16 |* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
17 |* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
19 |* No library is required when using these functions. *|
21 |*===----------------------------------------------------------------------===*/
23 /* Please leave this file C-compatible. */
25 #ifndef SUPPORT_DATATYPES_H
26 #define SUPPORT_DATATYPES_H
28 #define HAVE_INTTYPES_H 1
29 #define HAVE_STDINT_H 1
30 #define HAVE_UINT64_T 1
31 #define HAVE_U_INT64_T 1
42 #ifdef HAVE_INTTYPES_H
53 #error "Compiler must provide an implementation of stdint.h"
59 #if !defined(UINT32_MAX)
60 # error "The standard header <cstdint> is not C++11 compliant. Must #define "\
61 "__STDC_LIMIT_MACROS before #including Support/DataTypes.h"
64 #if !defined(UINT32_C)
65 # error "The standard header <cstdint> is not C++11 compliant. Must #define "\
66 "__STDC_CONSTANT_MACROS before #including Support/DataTypes.h"
69 /* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
70 #include <sys/types.h>
73 // GCC is strict about defining large constants: they must have LL modifier.
78 /* Handle incorrect definition of uint64_t as u_int64_t */
81 typedef u_int64_t uint64_t;
83 # error "Don't have a definition for uint64_t on this platform"
95 #include <sys/types.h>
98 typedef signed __int64 ssize_t;
100 typedef signed int ssize_t;
103 #ifndef HAVE_INTTYPES_H
104 #define PRId64 "I64d"
105 #define PRIi64 "I64i"
106 #define PRIo64 "I64o"
107 #define PRIu64 "I64u"
108 #define PRIx64 "I64x"
109 #define PRIX64 "I64X"
117 #endif /* HAVE_INTTYPES_H */
119 #endif /* _MSC_VER */
121 /* Set defaults for constants which we cannot find. */
122 #if !defined(INT64_MAX)
123 # define INT64_MAX 9223372036854775807LL
125 #if !defined(INT64_MIN)
126 # define INT64_MIN ((-INT64_MAX)-1)
128 #if !defined(UINT64_MAX)
129 # define UINT64_MAX 0xffffffffffffffffULL
133 #define HUGE_VALF (float)HUGE_VAL
136 #endif /* SUPPORT_DATATYPES_H */