1 //===-- include/Support/DataTypes.h - Define fixed size types ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source 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 definitions:
14 // ENDIAN_LITTLE : is #define'd if the host is little endian
15 // int64_t : is a typedef for the signed 64 bit system type
16 // uint64_t : is a typedef for the unsigned 64 bit system type
17 // INT64_MAX : is a #define specifying the max value for int64_t's
19 // No library is required when using these functinons.
21 //===----------------------------------------------------------------------===//
23 #ifndef SUPPORT_DATATYPES_H
24 #define SUPPORT_DATATYPES_H
26 #include "Config/config.h"
28 // Note that this header's correct operation depends on __STDC_LIMIT_MACROS
29 // being defined. We would define it here, but in order to prevent Bad Things
30 // happening when system headers or C++ STL headers include stdint.h before
31 // we define it here, we define it on the g++ command line (in Makefile.rules).
37 #ifdef HAVE_INTTYPES_H
41 #ifdef HAVE_SYS_TYPES_H
42 #include <sys/types.h>
45 #if (defined(ENDIAN_LITTLE) && defined(ENDIAN_BIG))
46 #error "Cannot define both ENDIAN_LITTLE and ENDIAN_BIG!"
49 #if (!defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG))
50 #error "include/Support/DataTypes.h could not determine endianness!"
53 #if !defined(INT64_MAX)
54 /* We couldn't determine INT64_MAX; default it. */
55 #define INT64_MAX 9223372036854775807LL
57 #if !defined(UINT64_MAX)
58 #define UINT64_MAX 0xffffffffffffffffULL
61 #endif /* SUPPORT_DATATYPES_H */