2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1996, 99, 2003 by Ralf Baechle
8 #ifndef _ASM_BYTEORDER_H
9 #define _ASM_BYTEORDER_H
11 #include <asm/types.h>
15 #ifdef CONFIG_CPU_MIPSR2
17 static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
26 #define __arch__swab16(x) ___arch__swab16(x)
28 static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
38 #define __arch__swab32(x) ___arch__swab32(x)
40 #ifdef CONFIG_CPU_MIPS64_R2
42 static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
47 " drotr %0, %0, 32 \n"
54 #define __arch__swab64(x) ___arch__swab64(x)
56 #endif /* CONFIG_CPU_MIPS64_R2 */
58 #endif /* CONFIG_CPU_MIPSR2 */
60 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
61 # define __BYTEORDER_HAS_U64__
62 # define __SWAB_64_THRU_32__
67 #if defined(__MIPSEB__)
68 # include <linux/byteorder/big_endian.h>
69 #elif defined(__MIPSEL__)
70 # include <linux/byteorder/little_endian.h>
72 # error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
75 #endif /* _ASM_BYTEORDER_H */