2001-07-23 18:26:21 +00:00
|
|
|
//===-- 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:
|
|
|
|
//
|
2003-06-16 21:14:57 +00:00
|
|
|
// 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
|
2001-07-23 18:26:21 +00:00
|
|
|
//
|
|
|
|
// No library is required when using these functinons.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2001-06-06 20:29:01 +00:00
|
|
|
|
|
|
|
// TODO: This file sucks. Not only does it not work, but this stuff should be
|
|
|
|
// autoconfiscated anyways. Major FIXME
|
|
|
|
|
2001-07-23 17:46:59 +00:00
|
|
|
#ifndef LLVM_SUPPORT_DATATYPES_H
|
|
|
|
#define LLVM_SUPPORT_DATATYPES_H
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2002-09-13 21:51:25 +00:00
|
|
|
#define __STDC_LIMIT_MACROS 1
|
2002-05-23 15:48:12 +00:00
|
|
|
#include <inttypes.h>
|
|
|
|
|
2002-09-13 15:37:58 +00:00
|
|
|
#ifdef __linux__
|
2002-09-14 19:52:49 +00:00
|
|
|
# include <endian.h>
|
|
|
|
# if BYTE_ORDER == LITTLE_ENDIAN
|
|
|
|
# undef BIG_ENDIAN
|
|
|
|
# else
|
|
|
|
# undef LITTLE_ENDIAN
|
|
|
|
# endif
|
2003-06-16 21:14:57 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
# include <machine/endian.h>
|
|
|
|
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
|
|
|
# ifndef LITTLE_ENDIAN
|
|
|
|
# define LITTLE_ENDIAN 1
|
|
|
|
# endif
|
|
|
|
# ifdef BIG_ENDIAN
|
|
|
|
# undef BIG_ENDIAN
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# ifndef BIG_ENDIAN
|
|
|
|
# define BIG_ENDIAN 1
|
|
|
|
# endif
|
|
|
|
# ifdef LITTLE_ENDIAN
|
|
|
|
# undef LITTLE_ENDIAN
|
|
|
|
# endif
|
2002-09-14 19:52:49 +00:00
|
|
|
# endif
|
2002-09-13 21:51:25 +00:00
|
|
|
#endif
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2002-09-13 21:51:25 +00:00
|
|
|
#ifdef __sparc__
|
2002-09-14 19:52:49 +00:00
|
|
|
# include <sys/types.h>
|
|
|
|
# ifdef _LITTLE_ENDIAN
|
|
|
|
# define LITTLE_ENDIAN 1
|
|
|
|
# else
|
|
|
|
# define BIG_ENDIAN 1
|
|
|
|
# endif
|
2001-06-06 20:29:01 +00:00
|
|
|
#endif
|
2002-09-14 19:52:49 +00:00
|
|
|
|
2003-06-16 21:14:57 +00:00
|
|
|
#if (defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN))
|
|
|
|
#error "Cannot define both LITTLE_ENDIAN and BIG_ENDIAN!"
|
2001-06-06 20:29:01 +00:00
|
|
|
#endif
|
|
|
|
|
2003-06-16 21:14:57 +00:00
|
|
|
#if (!defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)) || !defined(INT64_MAX)
|
2002-09-13 21:51:25 +00:00
|
|
|
#error "include/Support/DataTypes.h could not determine endianness!"
|
2001-06-06 20:29:01 +00:00
|
|
|
#endif
|
2002-09-13 21:51:25 +00:00
|
|
|
|
|
|
|
#endif /* LLVM_SUPPORT_DATATYPES_H */
|