1/* 2** Copyright 2003, Axel D�fler, axeld@pinc-software.de. All rights reserved. 3** Distributed under the terms of the OpenBeOS License. 4*/ 5 6#define FUNCTION(x) .global x; .type x,@function; x 7 8.text 9 10/* uint16 __swap_int16(uint16 value) 11 */ 12FUNCTION(__swap_int16): 13 moveq.l #0,%d0 14 move.b (5,%a7),%d0 15 lsl.w #8,%d0 16 move.b (4,%a7),%d0 17 rts 18 19 20/* uint32 __swap_int32(uint32 value) 21 */ 22FUNCTION(__swap_int32): 23/* moveq.l #0,%d0*/ 24 move.b (7,%a7),%d0 25 lsl.w #8,%d0 26 move.b (6,%a7),%d0 27 lsl.w #8,%d0 28 move.b (5,%a7),%d0 29 lsl.w #8,%d0 30 move.b (4,%a7),%d0 31 rts 32 33 34/* uint64 __swap_int64(uint64 value) 35 */ 36FUNCTION(__swap_int64): 37/* moveq.l #0,%d0*/ 38 move.b (7,%a7),%d0 39 lsl.w #8,%d0 40 move.b (6,%a7),%d0 41 lsl.w #8,%d0 42 move.b (5,%a7),%d0 43 lsl.w #8,%d0 44 move.b (4,%a7),%d0 45 move.l %d0,(%a0) 46 move.b (11,%a7),%d0 47 lsl.w #8,%d0 48 move.b (10,%a7),%d0 49 lsl.w #8,%d0 50 move.b (9,%a7),%d0 51 lsl.w #8,%d0 52 move.b (8,%a7),%d0 53 move.l %d0,(4,%a0) 54 rts 55 56 57/* TODO: The following functions can surely be optimized. A simple optimization 58 * would be to define macros with the contents of the __swap_int{32,64} 59 * functions and use those instead of calling the functions. 60 */ 61 62/* float __swap_float(float value) 63 */ 64FUNCTION(__swap_float): 65 jmp __swap_int32 66 //rts 67 68 69 70/* double __swap_double(double value) 71 */ 72FUNCTION(__swap_double): 73 jmp __swap_int32 74 //rts 75 //XXX:check sizeof(double) 76