summaryrefslogtreecommitdiffstats
path: root/include/asm-sparc/byteorder.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
committer <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
commit19c9bba94152148523ba0f7ef7cffe3d45656b11 (patch)
tree40b1cb534496a7f1ca0f5c314a523c69f1fee464 /include/asm-sparc/byteorder.h
parent7206675c40394c78a90e74812bbdbf8cf3cca1be (diff)
Import of Linux/MIPS 2.1.36
Diffstat (limited to 'include/asm-sparc/byteorder.h')
-rw-r--r--include/asm-sparc/byteorder.h50
1 files changed, 41 insertions, 9 deletions
diff --git a/include/asm-sparc/byteorder.h b/include/asm-sparc/byteorder.h
index 4f1cd2e65..6fd6d02e2 100644
--- a/include/asm-sparc/byteorder.h
+++ b/include/asm-sparc/byteorder.h
@@ -1,17 +1,17 @@
-/* $Id: byteorder.h,v 1.9 1996/08/30 05:21:34 davem Exp $ */
+/* $Id: byteorder.h,v 1.12 1996/12/19 08:08:20 davem Exp $ */
#ifndef _SPARC_BYTEORDER_H
#define _SPARC_BYTEORDER_H
-#define ntohl(x) x
-#define ntohs(x) x
-#define htonl(x) x
-#define htons(x) x
+#define ntohl(x) (x)
+#define ntohs(x) (x)
+#define htonl(x) (x)
+#define htons(x) (x)
/* Some programs depend upon these being around. */
-#define __constant_ntohl(x) x
-#define __constant_ntohs(x) x
-#define __constant_htonl(x) x
-#define __constant_htons(x) x
+#define __constant_ntohl(x) (x)
+#define __constant_ntohs(x) (x)
+#define __constant_htonl(x) (x)
+#define __constant_htons(x) (x)
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN 4321
@@ -21,4 +21,36 @@
#define __BIG_ENDIAN_BITFIELD
#endif
+#ifdef __KERNEL__
+
+/* Convert from CPU byte order, to specified byte order. */
+extern __inline__ __u16 cpu_to_le16(__u16 value)
+{
+ return (value >> 8) | (value << 8);
+}
+
+extern __inline__ __u32 cpu_to_le32(__u32 value)
+{
+ return((value>>24) | ((value>>8)&0xff00) |
+ ((value<<8)&0xff0000) | (value<<24));
+}
+#define cpu_to_be16(x) (x)
+#define cpu_to_be32(x) (x)
+
+/* Convert from specified byte order, to CPU byte order. */
+extern __inline__ __u16 le16_to_cpu(__u16 value)
+{
+ return (value >> 8) | (value << 8);
+}
+
+extern __inline__ __u32 le32_to_cpu(__u32 value)
+{
+ return((value>>24) | ((value>>8)&0xff00) |
+ ((value<<8)&0xff0000) | (value<<24));
+}
+#define be16_to_cpu(x) (x)
+#define be32_to_cpu(x) (x)
+
+#endif /* __KERNEL__ */
+
#endif /* !(_SPARC_BYTEORDER_H) */