]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/cris/include/arch-v10/arch/swab.h
cris: introduce asm/swab.h
[net-next-2.6.git] / arch / cris / include / arch-v10 / arch / swab.h
CommitLineData
aa0effbd
HH
1#ifndef _CRIS_ARCH_SWAB_H
2#define _CRIS_ARCH_SWAB_H
1da177e4
LT
3
4#include <asm/types.h>
5#include <linux/compiler.h>
6
aa0effbd
HH
7#define __SWAB_64_THRU_32__
8
1da177e4
LT
9/* we just define these two (as we can do the swap in a single
10 * asm instruction in CRIS) and the arch-independent files will put
11 * them together into ntohl etc.
12 */
13
aa0effbd 14static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
1da177e4
LT
15{
16 __asm__ ("swapwb %0" : "=r" (x) : "0" (x));
aa0effbd 17
1da177e4
LT
18 return(x);
19}
aa0effbd 20#define __arch_swab32 __arch_swab32
1da177e4 21
aa0effbd 22static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
1da177e4
LT
23{
24 __asm__ ("swapb %0" : "=r" (x) : "0" (x));
aa0effbd 25
1da177e4
LT
26 return(x);
27}
aa0effbd 28#define __arch_swab16 __arch_swab16
1da177e4
LT
29
30#endif