From b32fe7938aec28da98591f2983895233b0ccd04d Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 4 Oct 2002 13:24:06 +0000 Subject: 2002-10-04 Jay Monkman * rtems/score/cpu.h: Fix u16 and u32 swap routines. --- cpukit/score/cpu/arm/ChangeLog | 4 ++++ cpukit/score/cpu/arm/rtems/score/cpu.h | 30 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 15 deletions(-) (limited to 'cpukit') diff --git a/cpukit/score/cpu/arm/ChangeLog b/cpukit/score/cpu/arm/ChangeLog index 39ff8d8f1e..19a4b591c8 100644 --- a/cpukit/score/cpu/arm/ChangeLog +++ b/cpukit/score/cpu/arm/ChangeLog @@ -1,3 +1,7 @@ +2002-10-04 Jay Monkman + + * rtems/score/cpu.h: Fix u16 and u32 swap routines. + 2002-08-05 Joel Sherrill * rtems/score/cpu.h, rtems/score/types.h: Updated to fix some typos. diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h index d2f19e469d..1c4d3e82a6 100644 --- a/cpukit/score/cpu/arm/rtems/score/cpu.h +++ b/cpukit/score/cpu/arm/rtems/score/cpu.h @@ -897,27 +897,27 @@ static inline unsigned int CPU_swap_u32( unsigned int value ) { - unsigned32 tmp; - asm volatile ("EOR %1, %0, %0, ROR #16\n" \ - "BIC %1, %1, #0xff0000\n" \ - "MOV %0, %0, ROR #8\n" \ - "EOR %0, %0, %1, LSR #8\n" \ - : "=&r" (value), "=&r" (tmp) \ - : "0" (value)); + unsigned32 tmp = value; /* make compiler warnings go away */ + asm volatile ("EOR %1, %0, %0, ROR #16\n" + "BIC %1, %1, #0xff0000\n" + "MOV %0, %0, ROR #8\n" + "EOR %0, %0, %1, LSR #8\n" + : "=r" (value), "=r" (tmp) + : "0" (value), "1" (tmp)); return value; } static inline unsigned16 CPU_swap_u16(unsigned16 value) { - unsigned32 tmp = value; /* make compiler warnings go away */ - asm volatile ("MOV %1, %0, LSR #8\n" \ - "BIC %0, %0, #0xff00\n" \ - "MOV %0, %0, LSL #8\n" \ - "ORR %0, %0, %1\n" \ - : "=&r" (value), "=&r" (tmp) \ - : "0" (value)); - return value; + unsigned16 lower; + unsigned16 upper; + + value = value & (unsigned16) 0xffff; + lower = (value >> 8) ; + upper = (value << 8) ; + + return (lower | upper); } #ifdef __cplusplus -- cgit v1.2.3