History

endian: #define __BYTE_ORDER

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.

Joakim Tjernlund committed 16 years ago

Commit b3b77c81 parent e47103b9 files · +8 −31Browse files

Showing the changes to include/linux/byteorder (2 of 9 files). Show all

Unified · Split

2 files
  1. include/linux/byteorder/big_endian.h +3 −0
  2. include/linux/byteorder/little_endian.h +3 −0
include/linux/byteorder/big_endian.h+3−0
@@ -7,6 +7,9 @@ · 6 unmodified lines
77 #ifndef __BIG_ENDIAN_BITFIELD
88 #define __BIG_ENDIAN_BITFIELD
99 #endif
10+#ifndef __BYTE_ORDER
11+#define __BYTE_ORDER __BIG_ENDIAN
12+#endif
1013
1114 #include <linux/types.h>
1215 #include <linux/swab.h>
include/linux/byteorder/little_endian.h+3−0
@@ -7,6 +7,9 @@ · 6 unmodified lines
77 #ifndef __LITTLE_ENDIAN_BITFIELD
88 #define __LITTLE_ENDIAN_BITFIELD
99 #endif
10+#ifndef __BYTE_ORDER
11+#define __BYTE_ORDER __LITTLE_ENDIAN
12+#endif
1013
1114 #include <linux/types.h>
1215 #include <linux/swab.h>