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