xref: /haiku/src/system/libroot/os/arch/riscv64/byteorder.S (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1/*
2 * Copyright 2009, Johannes Wischert. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5
6#include <asm_defs.h>
7
8.text
9
10/*
11 * These aren't needed on gcc4+
12 *  uint16 __swap_int16(uint16 value)
13 *  uint32 __swap_int32(uint32 value)
14 *  uint64 __swap_int64(uint64 value)
15 */
16
17/* TODO: The following functions can surely be optimized. A simple optimization
18 * would be to define macros with the contents of the __swap_int{32,64}
19 * functions and use those instead of calling the functions.
20 */
21
22/* float __swap_float(float value)
23 */
24FUNCTION(__swap_float):
25		// Assumes single precision
26		b		__swap_int32
27		//rts
28FUNCTION_END(__swap_float)
29
30
31/* double __swap_double(double value)
32 */
33FUNCTION(__swap_double):
34		// Assumes double is int64 on RV64
35		b		__swap_int64
36		//rts
37FUNCTION_END(__swap_double)
38
39