xref: /linux/include/linux/swab.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_SWAB_H
3 #define _LINUX_SWAB_H
4 
5 #include <uapi/linux/swab.h>
6 
7 # define swab16 __swab16
8 # define swab32 __swab32
9 # define swab64 __swab64
10 # define swab __swab
11 # define swahw32 __swahw32
12 # define swahb32 __swahb32
13 # define swab16p __swab16p
14 # define swab32p __swab32p
15 # define swab64p __swab64p
16 # define swahw32p __swahw32p
17 # define swahb32p __swahb32p
18 # define swab16s __swab16s
19 # define swab32s __swab32s
20 # define swab64s __swab64s
21 # define swahw32s __swahw32s
22 # define swahb32s __swahb32s
23 
swab16_array(u16 * buf,unsigned int words)24 static inline void swab16_array(u16 *buf, unsigned int words)
25 {
26 	while (words--) {
27 		swab16s(buf);
28 		buf++;
29 	}
30 }
31 
swab32_array(u32 * buf,unsigned int words)32 static inline void swab32_array(u32 *buf, unsigned int words)
33 {
34 	while (words--) {
35 		swab32s(buf);
36 		buf++;
37 	}
38 }
39 
swab64_array(u64 * buf,unsigned int words)40 static inline void swab64_array(u64 *buf, unsigned int words)
41 {
42 	while (words--) {
43 		swab64s(buf);
44 		buf++;
45 	}
46 }
47 
48 #endif /* _LINUX_SWAB_H */
49