patch-2.0.21-2.1.0 linux/include/asm-m68k/byteorder.h

Next file: linux/include/asm-m68k/delay.h
Previous file: linux/include/asm-m68k/bootinfo.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file lx2.0/v2.0.21/linux/include/asm-m68k/byteorder.h linux/include/asm-m68k/byteorder.h
@@ -1,14 +1,47 @@
 #ifndef _M68K_BYTEORDER_H
 #define _M68K_BYTEORDER_H
 
-#ifdef __KERNEL__
-#define __BIG_ENDIAN
+#ifndef __BIG_ENDIAN
+#define __BIG_ENDIAN 4321
 #endif
+
+#ifndef __BIG_ENDIAN_BITFIELD
 #define __BIG_ENDIAN_BITFIELD
+#endif
+
+#undef ntohl
+#undef ntohs
+#undef htonl
+#undef htons
+
+extern unsigned long int	ntohl(unsigned long int);
+extern unsigned short int	ntohs(unsigned short int);
+extern unsigned long int	htonl(unsigned long int);
+extern unsigned short int	htons(unsigned short int);
+
+extern __inline__ unsigned long int	__ntohl(unsigned long int);
+extern __inline__ unsigned short int	__ntohs(unsigned short int);
 
-#define ntohl(x) x
-#define ntohs(x) x
-#define htonl(x) x
-#define htons(x) x
+extern __inline__ unsigned long int
+__ntohl(unsigned long int x)
+{
+	return x;
+}
+
+extern __inline__ unsigned short int
+__ntohs(unsigned short int x)
+{
+	return x;
+}
+
+#define __htonl(x) __ntohl(x)
+#define __htons(x) __ntohs(x)
+
+#ifdef __OPTIMIZE__
+#define ntohl(x) __ntohl(x)
+#define ntohs(x) __ntohs(x)
+#define htonl(x) __htonl(x)
+#define htons(x) __htons(x)
+#endif
 
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov