mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-22 17:01:14 +00:00
ARM: 5772/1: Use REV and REV16 for byte swapping on ARMv6+
ARMv6 introduced the REV and REV16 instructions that reverse bytes in words and halfwords. Use them for the arch-specific implementation of the byte swapping helpers on ARMv6+. Signed-off-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
a8cf81ffe0
commit
40f5b07832
1 changed files with 19 additions and 0 deletions
|
@ -22,6 +22,24 @@
|
||||||
# define __SWAB_64_THRU_32__
|
# define __SWAB_64_THRU_32__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__KERNEL__) && __LINUX_ARM_ARCH__ >= 6
|
||||||
|
|
||||||
|
static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
|
||||||
|
{
|
||||||
|
__asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x));
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
#define __arch_swab16 __arch_swab16
|
||||||
|
|
||||||
|
static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
|
||||||
|
{
|
||||||
|
__asm__ ("rev %0, %1" : "=r" (x) : "r" (x));
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
#define __arch_swab32 __arch_swab32
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
|
static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
|
||||||
{
|
{
|
||||||
__u32 t;
|
__u32 t;
|
||||||
|
@ -48,3 +66,4 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue