/* ** Copyright 2003, Axel D�fler, axeld@pinc-software.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ #define FUNCTION(x) .global x; .type x,@function; x .text /* uint16 __swap_int16(uint16 value) */ FUNCTION(__swap_int16): moveq.l #0,%d0 move.b (5,%a7),%d0 lsl.w #8,%d0 move.b (4,%a7),%d0 rts /* uint32 __swap_int32(uint32 value) */ FUNCTION(__swap_int32): /* moveq.l #0,%d0*/ move.b (7,%a7),%d0 lsl.w #8,%d0 move.b (6,%a7),%d0 lsl.w #8,%d0 move.b (5,%a7),%d0 lsl.w #8,%d0 move.b (4,%a7),%d0 rts /* uint64 __swap_int64(uint64 value) */ FUNCTION(__swap_int64): /* moveq.l #0,%d0*/ move.b (7,%a7),%d0 lsl.w #8,%d0 move.b (6,%a7),%d0 lsl.w #8,%d0 move.b (5,%a7),%d0 lsl.w #8,%d0 move.b (4,%a7),%d0 move.l %d0,(%a0) move.b (11,%a7),%d0 lsl.w #8,%d0 move.b (10,%a7),%d0 lsl.w #8,%d0 move.b (9,%a7),%d0 lsl.w #8,%d0 move.b (8,%a7),%d0 move.l %d0,(4,%a0) rts /* TODO: The following functions can surely be optimized. A simple optimization * would be to define macros with the contents of the __swap_int{32,64} * functions and use those instead of calling the functions. */ /* float __swap_float(float value) */ FUNCTION(__swap_float): jmp __swap_int32 //rts /* double __swap_double(double value) */ FUNCTION(__swap_double): jmp __swap_int32 //rts //XXX:check sizeof(double)