Added support for stdint.h. It is now automatically included by
[oota-llvm.git] / include / llvm / Support / DataTypes.h.in
1 //===-- include/Support/DataTypes.h - Define fixed size types ---*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
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.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
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:
13 //
14 //   [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types
15 //   [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values.
16 //
17 // No library is required when using these functinons.
18 //
19 //===----------------------------------------------------------------------===//
20
21 #ifndef SUPPORT_DATATYPES_H
22 #define SUPPORT_DATATYPES_H
23
24 // Note that this header's correct operation depends on __STDC_LIMIT_MACROS
25 // being defined.  We would define it here, but in order to prevent Bad Things
26 // happening when system headers or C++ STL headers include stdint.h before
27 // we define it here, we define it on the g++ command line (in Makefile.rules).
28 #if !defined(__STDC_LIMIT_MACROS)
29 # error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
30 #endif
31
32 #ifndef _MSC_VER
33 // Note that <inttypes.h> includes <stdint.h>, if this is a C99 system.
34 @INCLUDE_INTTYPES_H@
35 @INCLUDE_SYS_TYPES_H@
36 @INCLUDE_STDINT_H@
37 #else
38 // Visual C++ doesn't provide standard integer headers, but it does provide
39 // built-in data types.
40 typedef __int64 int64_t;
41 typedef unsigned __int64 uint64_t;
42 typedef signed   int int32_t;
43 typedef unsigned int uint32_t;
44 typedef signed   int ssize_t;
45 #define INT8_MAX 127
46 #define INT8_MIN -128
47 #define UINT8_MAX 255
48 #define INT16_MAX 32767
49 #define INT16_MIN -32768
50 #define UINT16_MAX 65535
51 #define INT32_MAX 2147483647
52 #define INT32_MIN -2147483648
53 #define UINT32_MAX 4294967295U
54 #endif
55
56 #if !defined(INT64_MAX)
57 /* We couldn't determine INT64_MAX; default it. */
58 # define INT64_MAX 9223372036854775807LL
59 #endif
60 #if !defined(UINT64_MAX)
61 # define UINT64_MAX 0xffffffffffffffffULL
62 #endif
63
64 #endif  /* SUPPORT_DATATYPES_H */