|
|
// To check endianness and if compiler supports 64-bit type (sizeof(long long))
|
// To check endianness and if compiler supports 64-bit type (sizeof(long long))
|
#include "config.h"
|
#include "config.h"
|
|
|
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
| One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
|
| One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
|
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
# define BIGENDIAN
|
# define BIGENDIAN
|
#else
|
#else
|
# define LITTLEENDIAN
|
# define LITTLEENDIAN
|
#endif
|
#endif
|
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
| The macro `BITS64' can be defined to indicate that 64-bit integer types are
|
| The macro `BITS64' can be defined to indicate that 64-bit integer types are
|
| supported by the compiler.
|
| supported by the compiler.
|
| Configure script should check sizeof long long at configure time.
|
| Configure script should check sizeof long long at configure time.
|
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
|
|
#if SIZEOF_LONG_LONG!=8
|
#if SIZEOF_LONG_LONG!=8
|
# error Compiler does not appear to have 64-bit types. This is required for the SoftFloat library.
|
# error Compiler does not appear to have 64-bit types. This is required for the SoftFloat library.
|
#else
|
#else
|
#define BITS64
|
#define BITS64
|
#endif
|
#endif
|
|
|
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
| Each of the following `typedef's defines the most convenient type that holds
|
| Each of the following `typedef's defines the most convenient type that holds
|
| integers of at least as many bits as specified. For example, `uint8' should
|
| integers of at least as many bits as specified. For example, `uint8' should
|
| be the most convenient type that can hold unsigned integers of as many as
|
| be the most convenient type that can hold unsigned integers of as many as
|
| 8 bits. The `flag' type must be able to hold either a 0 or 1. For most
|
| 8 bits. The `flag' type must be able to hold either a 0 or 1. For most
|
| implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
|
| implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
|
| to the same as `int'.
|
| to the same as `int'.
|
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
typedef char flag;
|
typedef char flag;
|
typedef unsigned char uint8;
|
typedef unsigned char uint8;
|
typedef signed char int8;
|
typedef signed char int8;
|
typedef int uint16;
|
typedef int uint16;
|
typedef int int16;
|
typedef int int16;
|
typedef unsigned int uint32;
|
typedef unsigned int uint32;
|
typedef signed int int32;
|
typedef signed int int32;
|
#ifdef BITS64
|
#ifdef BITS64
|
typedef unsigned long long int uint64;
|
typedef unsigned long long int uint64;
|
typedef signed long long int int64;
|
typedef signed long long int int64;
|
#endif
|
#endif
|
|
|
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
| Each of the following `typedef's defines a type that holds integers
|
| Each of the following `typedef's defines a type that holds integers
|
| of _exactly_ the number of bits specified. For instance, for most
|
| of _exactly_ the number of bits specified. For instance, for most
|
| implementation of C, `bits16' and `sbits16' should be `typedef'ed to
|
| implementation of C, `bits16' and `sbits16' should be `typedef'ed to
|
| `unsigned short int' and `signed short int' (or `short int'), respectively.
|
| `unsigned short int' and `signed short int' (or `short int'), respectively.
|
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
typedef unsigned char bits8;
|
typedef unsigned char bits8;
|
typedef signed char sbits8;
|
typedef signed char sbits8;
|
typedef unsigned short int bits16;
|
typedef unsigned short int bits16;
|
typedef signed short int sbits16;
|
typedef signed short int sbits16;
|
typedef unsigned int bits32;
|
typedef unsigned int bits32;
|
typedef signed int sbits32;
|
typedef signed int sbits32;
|
#ifdef BITS64
|
#ifdef BITS64
|
typedef unsigned long long int bits64;
|
typedef unsigned long long int bits64;
|
typedef signed long long int sbits64;
|
typedef signed long long int sbits64;
|
#endif
|
#endif
|
|
|
#ifdef BITS64
|
#ifdef BITS64
|
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
| The `LIT64' macro takes as its argument a textual integer literal and
|
| The `LIT64' macro takes as its argument a textual integer literal and
|
| if necessary ``marks'' the literal as having a 64-bit integer type.
|
| if necessary ``marks'' the literal as having a 64-bit integer type.
|
| For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
|
| For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
|
| appended with the letters `LL' standing for `long long', which is `gcc's
|
| appended with the letters `LL' standing for `long long', which is `gcc's
|
| name for the 64-bit integer type. Some compilers may allow `LIT64' to be
|
| name for the 64-bit integer type. Some compilers may allow `LIT64' to be
|
| defined as the identity macro: `#define LIT64( a ) a'.
|
| defined as the identity macro: `#define LIT64( a ) a'.
|
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
#define LIT64( a ) a##LL
|
#define LIT64( a ) a##LL
|
#endif
|
#endif
|
|
|
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
| The macro `INLINE' can be used before functions that should be inlined. If
|
| The macro `INLINE' can be used before functions that should be inlined. If
|
| a compiler does not support explicit inlining, this macro should be defined
|
| a compiler does not support explicit inlining, this macro should be defined
|
| to be `static'.
|
| to be `static'.
|
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
|
#ifndef INLINE
|
#define INLINE extern inline
|
#define INLINE extern inline
|
|
#endif
|
|
|
|
|
|
|