1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 1996, 99, 2003 by Ralf Baechle
5 #ifndef _ASM_BYTEORDER_H
6 #define _ASM_BYTEORDER_H
12 #ifdef CONFIG_CPU_MIPSR2
14 static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
23 #define __arch__swab16(x) ___arch__swab16(x)
25 static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
35 #define __arch__swab32(x) ___arch__swab32(x)
37 #ifdef CONFIG_CPU_MIPS64_R2
39 static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
44 " drotr %0, %0, 32 \n"
51 #define __arch__swab64(x) ___arch__swab64(x)
53 #endif /* CONFIG_CPU_MIPS64_R2 */
55 #endif /* CONFIG_CPU_MIPSR2 */
57 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
58 # define __BYTEORDER_HAS_U64__
59 # define __SWAB_64_THRU_32__
64 #if defined(__MIPSEB__)
65 # include <linux/byteorder/big_endian.h>
66 #elif defined(__MIPSEL__)
67 # include <linux/byteorder/little_endian.h>
69 # error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
72 #endif /* _ASM_BYTEORDER_H */