Made error message more comprehensible.
[oota-llvm.git] / include / Support / DataTypes.h
1 //===-- include/Support/DataTypes.h - Define fixed size types ---*- C++ -*-===//
2 //
3 // This file contains definitions to figure out the size of _HOST_ data types.
4 // This file is important because different host OS's define different macros,
5 // which makes portability tough.  This file exports the following definitions:
6 //
7 //   ENDIAN_LITTLE : is #define'd if the host is little endian
8 //   int64_t       : is a typedef for the signed 64 bit system type
9 //   uint64_t      : is a typedef for the unsigned 64 bit system type
10 //   INT64_MAX     : is a #define specifying the max value for int64_t's
11 //
12 // No library is required when using these functinons.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef SUPPORT_DATATYPES_H
17 #define SUPPORT_DATATYPES_H
18
19 #include "Config/config.h"
20
21 #define __STDC_LIMIT_MACROS 1
22
23 #ifdef HAVE_INTTYPES_H
24 #include <inttypes.h>
25 #endif
26
27 #ifdef HAVE_SYS_TYPES_H
28 #include <sys/types.h>
29 #endif
30
31 #if (defined(ENDIAN_LITTLE) && defined(ENDIAN_BIG))
32 #error "Cannot define both ENDIAN_LITTLE and ENDIAN_BIG!"
33 #endif
34
35 #if (!defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG))
36 #error "include/Support/DataTypes.h could not determine endianness!"
37 #endif
38
39 #if !defined(INT64_MAX)
40 /* We couldn't determine INT64_MAX; default it. */
41 #define INT64_MAX 9223372036854775807LL
42 #endif
43 #if !defined(UINT64_MAX)
44 #define UINT64_MAX 0xffffffffffffffffULL
45 #endif
46
47 #endif  /* SUPPORT_DATATYPES_H */