aboutsummaryrefslogtreecommitdiff
path: root/include/Support/DataTypes.h
blob: 063c4644577a1d382f9098846a46e1c3637871be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//===-- include/Support/DataTypes.h - Define fixed size types ----*- C++ -*--=//
//
// This file contains definitions to figure out the size of _HOST_ data types.
// This file is important because different host OS's define different macros,
// which makes portability tough.  This file exports the following definitions:
//
//   LITTLE_ENDIAN: is #define'd if the host is little endian
//   int64_t      : is a typedef for the signed 64 bit system type
//   uint64_t     : is a typedef for the unsigned 64 bit system type
//   INT64_MAX    : is a #define specifying the max value for int64_t's
//
// No library is required when using these functinons.
//
//===----------------------------------------------------------------------===//

// TODO: This file sucks.  Not only does it not work, but this stuff should be
// autoconfiscated anyways. Major FIXME

#ifndef LLVM_SUPPORT_DATATYPES_H
#define LLVM_SUPPORT_DATATYPES_H

#define __STDC_LIMIT_MACROS 1
#include <inttypes.h>

#ifdef __linux__
#include <endian.h>
#endif

#ifdef __sparc__
#include <sys/types.h>
#ifdef _LITTLE_ENDIAN
#define LITTLE_ENDIAN 1
#else
#define BIG_ENDIAN 1
#endif
#endif

#if (!defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)) || !defined(INT64_MAX)
#error "include/Support/DataTypes.h could not determine endianness!"
#endif

#endif  /* LLVM_SUPPORT_DATATYPES_H */