From f6b7365dc8759d6df5d340e4a68fb75537c07be4 Mon Sep 17 00:00:00 2001 From: aqua Date: Sat, 31 Dec 2022 16:03:20 +0200 Subject: blake2: use makefiles instead of meson.build --- lib/endian/little.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 lib/endian/little.c (limited to 'lib/endian') diff --git a/lib/endian/little.c b/lib/endian/little.c new file mode 100644 index 0000000..042bb55 --- /dev/null +++ b/lib/endian/little.c @@ -0,0 +1,43 @@ +//===================================================================== +// spdx-license-identifier: ISC +//===================================================================== + +#include "endian.h" + +#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ +#error little.c included in build on big endian target +#endif + +uint16_t +htole16(uint16_t host_16b) +{ + return host_16b; +} + +uint32_t +htole32(uint32_t host_32b) +{ + return host_32b; +} + +uint64_t +htole64(uint64_t host_64b) +{ + return host_64b; +} + +uint16_t +htobe16(uint16_t host_16b) +{ + return __builtin_bswap16(host_16b); +} +uint32_t +htobe32(uint32_t host_32b) +{ + return __builtin_bswap32(host_32b); +} +uint64_t +htobe64(uint64_t host_64b) +{ + return __builtin_bswap64(host_64b); +} -- cgit v1.2.1