1 /* $NetBSD: byte_swap.h,v 1.3 2006/02/16 20:17:15 perry Exp $ */
3 /* Written by Manuel Bouyer. Public domain */
5 #ifndef _SH3_BYTE_SWAP_H_
6 #define _SH3_BYTE_SWAP_H_
11 #include <sys/types.h>
14 #define __BYTE_SWAP_U16_VARIABLE __byte_swap_u16_variable
15 static __inline
uint16_t
16 __byte_swap_u16_variable(uint16_t x
)
20 __asm
volatile ("swap.b %1,%0" : "=r"(rval
) : "r"(x
));
25 #define __BYTE_SWAP_U32_VARIABLE __byte_swap_u32_variable
26 static __inline
uint32_t
27 __byte_swap_u32_variable(uint32_t x
)
31 __asm
volatile ("swap.b %1,%0; swap.w %0,%0; swap.b %0,%0"
32 : "=r"(rval
) : "r"(x
));
40 #endif /* !_SH3_BYPE_SWAP_H_ */