1 |
234 |
jeremybenn |
|
2 |
|
|
// To check endianness and if compiler supports 64-bit type (sizeof(long long))
|
3 |
|
|
#include "config.h"
|
4 |
|
|
|
5 |
|
|
/*----------------------------------------------------------------------------
|
6 |
|
|
| One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
|
7 |
|
|
*----------------------------------------------------------------------------*/
|
8 |
|
|
#ifdef WORDS_BIGENDIAN
|
9 |
|
|
# define BIGENDIAN
|
10 |
|
|
#else
|
11 |
|
|
# define LITTLEENDIAN
|
12 |
|
|
#endif
|
13 |
|
|
/*----------------------------------------------------------------------------
|
14 |
|
|
| The macro `BITS64' can be defined to indicate that 64-bit integer types are
|
15 |
|
|
| supported by the compiler.
|
16 |
|
|
| Configure script should check sizeof long long at configure time.
|
17 |
|
|
*----------------------------------------------------------------------------*/
|
18 |
|
|
|
19 |
|
|
#if SIZEOF_LONG_LONG!=8
|
20 |
|
|
# error Compiler does not appear to have 64-bit types. This is required for the SoftFloat library.
|
21 |
|
|
#else
|
22 |
|
|
#define BITS64
|
23 |
|
|
#endif
|
24 |
|
|
|
25 |
|
|
/*----------------------------------------------------------------------------
|
26 |
|
|
| Each of the following `typedef's defines the most convenient type that holds
|
27 |
|
|
| integers of at least as many bits as specified. For example, `uint8' should
|
28 |
|
|
| be the most convenient type that can hold unsigned integers of as many as
|
29 |
|
|
| 8 bits. The `flag' type must be able to hold either a 0 or 1. For most
|
30 |
|
|
| implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
|
31 |
|
|
| to the same as `int'.
|
32 |
|
|
*----------------------------------------------------------------------------*/
|
33 |
|
|
typedef char flag;
|
34 |
|
|
typedef unsigned char uint8;
|
35 |
|
|
typedef signed char int8;
|
36 |
|
|
typedef int uint16;
|
37 |
|
|
typedef int int16;
|
38 |
|
|
typedef unsigned int uint32;
|
39 |
|
|
typedef signed int int32;
|
40 |
|
|
#ifdef BITS64
|
41 |
|
|
typedef unsigned long long int uint64;
|
42 |
|
|
typedef signed long long int int64;
|
43 |
|
|
#endif
|
44 |
|
|
|
45 |
|
|
/*----------------------------------------------------------------------------
|
46 |
|
|
| Each of the following `typedef's defines a type that holds integers
|
47 |
|
|
| of _exactly_ the number of bits specified. For instance, for most
|
48 |
|
|
| implementation of C, `bits16' and `sbits16' should be `typedef'ed to
|
49 |
|
|
| `unsigned short int' and `signed short int' (or `short int'), respectively.
|
50 |
|
|
*----------------------------------------------------------------------------*/
|
51 |
|
|
typedef unsigned char bits8;
|
52 |
|
|
typedef signed char sbits8;
|
53 |
|
|
typedef unsigned short int bits16;
|
54 |
|
|
typedef signed short int sbits16;
|
55 |
|
|
typedef unsigned int bits32;
|
56 |
|
|
typedef signed int sbits32;
|
57 |
|
|
#ifdef BITS64
|
58 |
|
|
typedef unsigned long long int bits64;
|
59 |
|
|
typedef signed long long int sbits64;
|
60 |
|
|
#endif
|
61 |
|
|
|
62 |
|
|
#ifdef BITS64
|
63 |
|
|
/*----------------------------------------------------------------------------
|
64 |
|
|
| The `LIT64' macro takes as its argument a textual integer literal and
|
65 |
|
|
| if necessary ``marks'' the literal as having a 64-bit integer type.
|
66 |
|
|
| For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
|
67 |
|
|
| appended with the letters `LL' standing for `long long', which is `gcc's
|
68 |
|
|
| name for the 64-bit integer type. Some compilers may allow `LIT64' to be
|
69 |
|
|
| defined as the identity macro: `#define LIT64( a ) a'.
|
70 |
|
|
*----------------------------------------------------------------------------*/
|
71 |
|
|
#define LIT64( a ) a##LL
|
72 |
|
|
#endif
|
73 |
|
|
|
74 |
|
|
/*----------------------------------------------------------------------------
|
75 |
|
|
| The macro `INLINE' can be used before functions that should be inlined. If
|
76 |
|
|
| a compiler does not support explicit inlining, this macro should be defined
|
77 |
|
|
| to be `static'.
|
78 |
|
|
*----------------------------------------------------------------------------*/
|
79 |
236 |
jeremybenn |
#ifndef INLINE
|
80 |
234 |
jeremybenn |
#define INLINE extern inline
|
81 |
236 |
jeremybenn |
#endif
|
82 |
234 |
jeremybenn |
|
83 |
236 |
jeremybenn |
|