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.
Showing the changes to include/linux/byteorder (2 of 9 files). Show all
Unified · Split
| @@ -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> |