diff options
author | Christophe Lombard <clombard@linux.ibm.com> | 2023-06-20 16:52:02 +0200 |
---|---|---|
committer | Reza Arbab <arbab@linux.ibm.com> | 2023-09-12 14:22:11 -0500 |
commit | 18c9b278e7473204ab5bef69e788a29f92a130c3 (patch) | |
tree | 212e71c75e55eaf8e5512e334972ca2815175c84 | |
parent | ff47ae78f20babbc023b1378cb895f4bd2d8aed5 (diff) | |
download | skiboot-18c9b278e7473204ab5bef69e788a29f92a130c3.zip skiboot-18c9b278e7473204ab5bef69e788a29f92a130c3.tar.gz skiboot-18c9b278e7473204ab5bef69e788a29f92a130c3.tar.bz2 |
include: Provide endian conversion functions
Implement the BSD endian conversion functions in terms of the ccan
ones since the external libraries: libpldm and libmctp use them heavily.
Signed-off-by: Christophe Lombard <clombard@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
-rw-r--r-- | include/endian.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/endian.h b/include/endian.h new file mode 100644 index 0000000..df1342e --- /dev/null +++ b/include/endian.h @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later +/* Copyright 2013-2022 IBM Corp. */ + +#ifndef _ENDIAN_H_ +#define _ENDIAN_H_ + +#include <ccan/endian/endian.h> + +/* use the ccan endian conversion functions */ +#define htobe16 cpu_to_be16 +#define htobe32 cpu_to_be32 +#define htole16 cpu_to_le16 +#define htole32 cpu_to_le32 +#define htobe64 cpu_to_be64 +#define htole64 cpu_to_le64 + +#define be16toh be16_to_cpu +#define be32toh be32_to_cpu +#define le16toh le16_to_cpu +#define le32toh le32_to_cpu +#define le64toh le64_to_cpu +#define be64toh be64_to_cpu + +#endif /* _ENDIAN_H_ */ |