Linux does not define __BYTE_ORDER in its endian header files which makes some header files bend backwards to get at the current endian. Lets #define __BYTE_ORDER in big_endian.h/litte_endian.h to make it easier for header files that are used in user space too. In userspace the convention is that 1. _both_ __LITTLE_ENDIAN and __BIG_ENDIAN are defined, 2. you have to test for e.g. __BYTE_ORDER == __BIG_ENDIAN.
Unified · Split
| @@ -28,8 +28,3 @@ extern unsigned long __udiv_qrnnd (unsigned long *, unsigned long, · 27 unmodified lines | ||
| 28 | 28 | #define UDIV_NEEDS_NORMALIZATION 1 |
| 29 | 29 | |
| 30 | 30 | #define abort() goto bad_insn |
| 31 | − | |
| 32 | −#ifndef __LITTLE_ENDIAN | |
| 33 | −#define __LITTLE_ENDIAN -1 | |
| 34 | −#endif | |
| 35 | −#define __BYTE_ORDER __LITTLE_ENDIAN | |
| @@ -353,12 +353,6 @@ · 352 unmodified lines | ||
| 353 | 353 | #define abort() \ |
| 354 | 354 | return 0 |
| 355 | 355 | |
| 356 | −#ifdef __BIG_ENDIAN | |
| 357 | −#define __BYTE_ORDER __BIG_ENDIAN | |
| 358 | −#else | |
| 359 | −#define __BYTE_ORDER __LITTLE_ENDIAN | |
| 360 | −#endif | |
| 361 | − | |
| 362 | 356 | /* Exception flags. */ |
| 363 | 357 | #define EFLAG_INVALID (1 << (31 - 2)) |
| 364 | 358 | #define EFLAG_OVERFLOW (1 << (31 - 3)) |
| @@ -73,5 +73,3 @@ extern unsigned long __udiv_qrnnd (unsigned int *, unsigned int, · 72 unmodified lines | ||
| 73 | 73 | #define UDIV_NEEDS_NORMALIZATION 0 |
| 74 | 74 | |
| 75 | 75 | #define abort() return 0 |
| 76 | − | |
| 77 | −#define __BYTE_ORDER __BIG_ENDIAN | |
| @@ -66,7 +66,3 @@ · 65 unmodified lines | ||
| 66 | 66 | } while (0) |
| 67 | 67 | |
| 68 | 68 | #define abort() return 0 |
| 69 | − | |
| 70 | −#define __BYTE_ORDER __LITTLE_ENDIAN | |
| 71 | − | |
| 72 | − | |
| @@ -107,9 +107,3 @@ · 106 unmodified lines | ||
| 107 | 107 | |
| 108 | 108 | #define abort() \ |
| 109 | 109 | return 0 |
| 110 | − | |
| 111 | −#ifdef __BIG_ENDIAN | |
| 112 | −#define __BYTE_ORDER __BIG_ENDIAN | |
| 113 | −#else | |
| 114 | −#define __BYTE_ORDER __LITTLE_ENDIAN | |
| 115 | −#endif | |
| @@ -112,9 +112,3 @@ · 111 unmodified lines | ||
| 112 | 112 | |
| 113 | 113 | #define abort() \ |
| 114 | 114 | return 0 |
| 115 | − | |
| 116 | −#ifdef __BIG_ENDIAN | |
| 117 | −#define __BYTE_ORDER __BIG_ENDIAN | |
| 118 | −#else | |
| 119 | −#define __BYTE_ORDER __LITTLE_ENDIAN | |
| 120 | −#endif | |
| @@ -195,11 +195,11 @@ static const char *sym_name(const char *sym_strtab, Elf32_Sym *sym) · 194 unmodified lines | ||
| 195 | 195 | |
| 196 | 196 | |
| 197 | 197 | |
| 198 | −#if BYTE_ORDER == LITTLE_ENDIAN | |
| 198 | +#if __BYTE_ORDER == __LITTLE_ENDIAN | |
| 199 | 199 | #define le16_to_cpu(val) (val) |
| 200 | 200 | #define le32_to_cpu(val) (val) |
| 201 | 201 | #endif |
| 202 | −#if BYTE_ORDER == BIG_ENDIAN | |
| 202 | +#if __BYTE_ORDER == __BIG_ENDIAN | |
| 203 | 203 | #define le16_to_cpu(val) bswap_16(val) |
| 204 | 204 | #define le32_to_cpu(val) bswap_32(val) |
| 205 | 205 | #endif |
| @@ -7,6 +7,9 @@ · 6 unmodified lines | ||
| 7 | 7 | #ifndef __BIG_ENDIAN_BITFIELD |
| 8 | 8 | #define __BIG_ENDIAN_BITFIELD |
| 9 | 9 | #endif |
| 10 | +#ifndef __BYTE_ORDER | |
| 11 | +#define __BYTE_ORDER __BIG_ENDIAN | |
| 12 | +#endif | |
| 10 | 13 | |
| 11 | 14 | #include <linux/types.h> |
| 12 | 15 | #include <linux/swab.h> |
| @@ -7,6 +7,9 @@ · 6 unmodified lines | ||
| 7 | 7 | #ifndef __LITTLE_ENDIAN_BITFIELD |
| 8 | 8 | #define __LITTLE_ENDIAN_BITFIELD |
| 9 | 9 | #endif |
| 10 | +#ifndef __BYTE_ORDER | |
| 11 | +#define __BYTE_ORDER __LITTLE_ENDIAN | |
| 12 | +#endif | |
| 10 | 13 | |
| 11 | 14 | #include <linux/types.h> |
| 12 | 15 | #include <linux/swab.h> |