source: trunk/sys/dietlibc/include/endian.h @ 8

Last change on this file since 8 was 1, checked in by alain, 8 years ago

First import

File size: 1.4 KB
Line 
1#ifndef _ENDIAN_H
2#define _ENDIAN_H
3
4#define __LITTLE_ENDIAN 1234
5#define __BIG_ENDIAN    4321
6
7#ifdef __mips__
8#if _MIPS_SIM == _MIPS_SIM_ABI64
9/*#define __mips64__*/ 
10#else
11#undef __mips64__
12#endif
13#endif
14
15#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || defined(__alpha__)
16#define __BYTE_ORDER            __LITTLE_ENDIAN
17#define __FLOAT_WORD_ORDER      __BYTE_ORDER
18#endif
19
20#if (defined(__mips__) && !defined(__MIPSEB)) || (defined(__arm__) && !defined(__ARMEB__)) || ((defined(__powerpc__) || defined(__sparc__)) && defined(__LITTLE_ENDIAN__))
21#define __BYTE_ORDER            __LITTLE_ENDIAN
22#define __FLOAT_WORD_ORDER      __BYTE_ORDER
23#endif
24
25/* rest is big endian */
26
27#ifndef __BYTE_ORDER
28#define __BYTE_ORDER            __BIG_ENDIAN
29#define __FLOAT_WORD_ORDER      __BYTE_ORDER
30#endif
31
32#define LITTLE_ENDIAN           __LITTLE_ENDIAN
33#define BIG_ENDIAN              __BIG_ENDIAN
34#define BYTE_ORDER              __BYTE_ORDER
35
36#if __BYTE_ORDER == __LITTLE_ENDIAN
37# define __LONG_LONG_PAIR(HI, LO) LO, HI
38#elif __BYTE_ORDER == __BIG_ENDIAN
39# define __LONG_LONG_PAIR(HI, LO) HI, LO
40#endif
41
42#if defined(__alpha__) || defined(__mips64__) || defined(__sparc_v9__) || defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__s390x__)
43//#warrrwordsize64
44#define __WORDSIZE 64
45#endif
46
47#if defined(__x86_64__) || defined(__powerpc64__) || defined(__sparc_v9__)
48#define __WORDSIZE_COMPAT32 1
49#endif
50
51#if defined(__sparc__) && (__arch64__)
52#define __WORDSIZE 64
53#endif
54
55#ifndef __WORDSIZE
56#define __WORDSIZE 32
57#endif
58
59#endif
Note: See TracBrowser for help on using the repository browser.