1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _ASM_SWAB_H
20 #define _ASM_SWAB_H
21 
22 
23 #include <linux/types.h>
24 
25 #define __SWAB_64_THRU_32__
26 
__arch_swab16(__u16 x)27 static __inline__  __u16 __arch_swab16(__u16 x)
28 {
29 	__asm__(
30 	"	revb.2h	%0, %1			\n"
31 	: "=r" (x)
32 	: "r" (x));
33 
34 	return x;
35 }
36 #define __arch_swab16 __arch_swab16
37 
__arch_swab32(__u32 x)38 static __inline__  __u32 __arch_swab32(__u32 x)
39 {
40 	__asm__(
41 	"	revb.2h	%0, %1			\n"
42 	"	rotri.w	%0, %0, 16		\n"
43 	: "=r" (x)
44 	: "r" (x));
45 
46 	return x;
47 }
48 #define __arch_swab32 __arch_swab32
49 
50 #ifdef __loongarch64
__arch_swab64(__u64 x)51 static __inline__  __u64 __arch_swab64(__u64 x)
52 {
53 	__asm__(
54 	"	revb.4h	%0, %1			\n"
55 	"	revh.d	%0, %0			\n"
56 	: "=r" (x)
57 	: "r" (x));
58 
59 	return x;
60 }
61 #define __arch_swab64 __arch_swab64
62 #endif /* __loongarch64 */
63 #endif /* _ASM_SWAB_H */
64