[Skiboot] [PATCH V4 4/9] include: Provide endian conversion functions
Nicholas Piggin
npiggin at gmail.com
Wed Jun 21 14:30:24 AEST 2023
On Wed Jun 21, 2023 at 12:52 AM AEST, Christophe Lombard wrote:
> 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 at linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin at gmail.com>
> ---
> include/endian.h | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
> create mode 100644 include/endian.h
>
> diff --git a/include/endian.h b/include/endian.h
> new file mode 100644
> index 00000000..df1342e2
> --- /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_ */
> --
> 2.40.1
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
More information about the Skiboot
mailing list