1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2005-2017 Andes Technology Corporation
4 #ifndef __NDS32_SWAB_H__
5 #define __NDS32_SWAB_H__
7 #include <linux/types.h>
8 #include <linux/compiler.h>
10 static __inline__ __attribute_const__ __u32
___arch__swab32(__u32 x
)
12 __asm__("wsbh %0, %0\n\t" /* word swap byte within halfword */
19 static __inline__ __attribute_const__ __u16
___arch__swab16(__u16 x
)
21 __asm__("wsbh %0, %0\n" /* word swap byte within halfword */
27 #define __arch_swab32(x) ___arch__swab32(x)
28 #define __arch_swab16(x) ___arch__swab16(x)
30 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
31 #define __BYTEORDER_HAS_U64__
32 #define __SWAB_64_THRU_32__
35 #endif /* __NDS32_SWAB_H__ */