xref: /dpdk/lib/eal/riscv/include/rte_byteorder.h (revision 719834a6849e1daf4a70ff7742bbcc3ae7e25607)
1 /*
2  * SPDX-License-Identifier: BSD-3-Clause
3  * Inspired from FreeBSD src/sys/powerpc/include/endian.h
4  * Copyright(c) 1987, 1991, 1993
5  * The Regents of the University of California.  All rights reserved.
6  */
7 
8 #ifndef RTE_BYTEORDER_RISCV_H
9 #define RTE_BYTEORDER_RISCV_H
10 
11 #include <stdint.h>
12 #include <rte_common.h>
13 #include "generic/rte_byteorder.h"
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #ifndef RTE_BYTE_ORDER
20 #define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN
21 #endif
22 
23 #define rte_cpu_to_le_16(x) (x)
24 #define rte_cpu_to_le_32(x) (x)
25 #define rte_cpu_to_le_64(x) (x)
26 
27 #define rte_cpu_to_be_16(x) rte_bswap16(x)
28 #define rte_cpu_to_be_32(x) rte_bswap32(x)
29 #define rte_cpu_to_be_64(x) rte_bswap64(x)
30 
31 #define rte_le_to_cpu_16(x) (x)
32 #define rte_le_to_cpu_32(x) (x)
33 #define rte_le_to_cpu_64(x) (x)
34 
35 #define rte_be_to_cpu_16(x) rte_bswap16(x)
36 #define rte_be_to_cpu_32(x) rte_bswap32(x)
37 #define rte_be_to_cpu_64(x) rte_bswap64(x)
38 
39 #ifdef __cplusplus
40 }
41 #endif
42 
43 #endif /* RTE_BYTEORDER_RISCV_H */
44