diff --git a/src/system/libroot/os/arch/arm/byteorder.S b/src/system/libroot/os/arch/arm/byteorder.S index 752c01a97a..5189c683f9 100644 --- a/src/system/libroot/os/arch/arm/byteorder.S +++ b/src/system/libroot/os/arch/arm/byteorder.S @@ -1,7 +1,7 @@ /* -** Copyright 2003, Axel D�fler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ + * Copyright 2009, Johannes Wischert. All rights reserved. + * Distributed under the terms of the MIT License. + */ #include @@ -14,7 +14,13 @@ FUNCTION(__swap_int16): rev16 r0,r0; #else #warning IMPLEMENT_ME + and r1,r0,#0x000000ff + and r2,r0,#0x0000ff00 + mov r1,r1,LSL #8 + mov r2,r2,ROR #8 + orr r0,r1,r2 #endif + mov pc,lr FUNCTION_END(__swap_int16) /* uint32 __swap_int32(uint32 value) @@ -24,7 +30,16 @@ FUNCTION(__swap_int32): rev r0,r0; #else #warning IMPLEMENT_ME + mov r3,#0xff000000 + orr r3,#0x0000ff00 + and r1,r0,r3 + mov r1,r1,ROR #24 + mov r3,r3,ROR #8 + and r2,r0,r3 + mov r2,r2,ROR #8 + orr r0,r1,r2 #endif + mov pc,lr FUNCTION_END(__swap_int32) /* uint64 __swap_int64(uint64 value) @@ -39,6 +54,7 @@ FUNCTION(__swap_int64): #else #warning IMPLEMENT_ME #endif + mov pc,lr FUNCTION_END(__swap_int64) /* TODO: The following functions can surely be optimized. A simple optimization