summaryrefslogtreecommitdiffstats
path: root/include/asm-sparc/byteorder.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sparc/byteorder.h')
-rw-r--r--include/asm-sparc/byteorder.h55
1 files changed, 46 insertions, 9 deletions
diff --git a/include/asm-sparc/byteorder.h b/include/asm-sparc/byteorder.h
index 758324f39..5becb7c5d 100644
--- a/include/asm-sparc/byteorder.h
+++ b/include/asm-sparc/byteorder.h
@@ -1,4 +1,4 @@
-/* $Id: byteorder.h,v 1.13 1997/05/26 23:37:46 davem Exp $ */
+/* $Id: byteorder.h,v 1.14 1997/05/28 11:35:38 jj Exp $ */
#ifndef _SPARC_BYTEORDER_H
#define _SPARC_BYTEORDER_H
@@ -37,19 +37,56 @@ extern __inline__ __u32 cpu_to_le32(__u32 value)
#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)
+/* The same, but returns converted value from the location pointer by addr. */
+extern __inline__ __u16 cpu_to_le16p(__u16 *addr)
{
- return (value >> 8) | (value << 8);
+ return cpu_to_le16(*addr);
}
-extern __inline__ __u32 le32_to_cpu(__u32 value)
+extern __inline__ __u32 cpu_to_le32p(__u32 *addr)
{
- return((value>>24) | ((value>>8)&0xff00) |
- ((value<<8)&0xff0000) | (value<<24));
+ return cpu_to_le32(*addr);
}
-#define be16_to_cpu(x) (x)
-#define be32_to_cpu(x) (x)
+
+extern __inline__ __u16 cpu_to_be16p(__u16 *addr)
+{
+ return cpu_to_be16(*addr);
+}
+
+extern __inline__ __u32 cpu_to_be32p(__u32 *addr)
+{
+ return cpu_to_be32(*addr);
+}
+
+/* The same, but do the conversion in situ, ie. put the value back to addr. */
+extern __inline__ void cpu_to_le16s(__u16 *addr)
+{
+ *addr = cpu_to_le16(*addr);
+}
+
+extern __inline__ void cpu_to_le32s(__u32 *addr)
+{
+ *addr = cpu_to_le32(*addr);
+}
+
+#define cpu_to_be16s(x) do { } while (0)
+#define cpu_to_be32s(x) do { } while (0)
+
+/* Convert from specified byte order, to CPU byte order. */
+#define le16_to_cpu(x) cpu_to_le16(x)
+#define le32_to_cpu(x) cpu_to_le32(x)
+#define be16_to_cpu(x) cpu_to_be16(x)
+#define be32_to_cpu(x) cpu_to_be32(x)
+
+#define le16_to_cpup(x) cpu_to_le16p(x)
+#define le32_to_cpup(x) cpu_to_le32p(x)
+#define be16_to_cpup(x) cpu_to_be16p(x)
+#define be32_to_cpup(x) cpu_to_be32p(x)
+
+#define le16_to_cpus(x) cpu_to_le16s(x)
+#define le32_to_cpus(x) cpu_to_le32s(x)
+#define be16_to_cpus(x) cpu_to_be16s(x)
+#define be32_to_cpus(x) cpu_to_be32s(x)
#endif /* __KERNEL__ */