mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #20985 from benpicco/picolibc-endian.h
sys/endian: fix build with picolibc
This commit is contained in:
commit
fe621438dd
@ -94,31 +94,79 @@ uint64_t le64toh(uint64_t little_endian_64bits);/**< little endian to host, 64 b
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||||
|
# ifndef htobe16
|
||||||
# define htobe16(_x) __builtin_bswap16(_x)
|
# define htobe16(_x) __builtin_bswap16(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef htole16
|
||||||
# define htole16(_x) ((uint16_t)(_x))
|
# define htole16(_x) ((uint16_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef be16toh
|
||||||
# define be16toh(_x) __builtin_bswap16(_x)
|
# define be16toh(_x) __builtin_bswap16(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef le16toh
|
||||||
# define le16toh(_x) ((uint16_t)(_x))
|
# define le16toh(_x) ((uint16_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef htobe32
|
||||||
# define htobe32(_x) __builtin_bswap32(_x)
|
# define htobe32(_x) __builtin_bswap32(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef htole32
|
||||||
# define htole32(_x) ((uint32_t)(_x))
|
# define htole32(_x) ((uint32_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef be32toh
|
||||||
# define be32toh(_x) __builtin_bswap32(_x)
|
# define be32toh(_x) __builtin_bswap32(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef le32toh
|
||||||
# define le32toh(_x) ((uint32_t)(_x))
|
# define le32toh(_x) ((uint32_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef htobe64
|
||||||
# define htobe64(_x) __builtin_bswap64(_x)
|
# define htobe64(_x) __builtin_bswap64(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef htole64
|
||||||
# define htole64(_x) ((uint64_t)(_x))
|
# define htole64(_x) ((uint64_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef be64toh
|
||||||
# define be64toh(_x) __builtin_bswap64(_x)
|
# define be64toh(_x) __builtin_bswap64(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef le64toh
|
||||||
# define le64toh(_x) ((uint64_t)(_x))
|
# define le64toh(_x) ((uint64_t)(_x))
|
||||||
|
# endif
|
||||||
#elif BYTE_ORDER == BIG_ENDIAN
|
#elif BYTE_ORDER == BIG_ENDIAN
|
||||||
|
# ifndef htole16
|
||||||
# define htole16(_x) __builtin_bswap16(_x)
|
# define htole16(_x) __builtin_bswap16(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef htobe16
|
||||||
# define htobe16(_x) ((uint16_t)(_x))
|
# define htobe16(_x) ((uint16_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef le16toh
|
||||||
# define le16toh(_x) __builtin_bswap16(_x)
|
# define le16toh(_x) __builtin_bswap16(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef be16toh
|
||||||
# define be16toh(_x) ((uint16_t)(_x))
|
# define be16toh(_x) ((uint16_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef htole32
|
||||||
# define htole32(_x) __builtin_bswap32(_x)
|
# define htole32(_x) __builtin_bswap32(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef htobe32
|
||||||
# define htobe32(_x) ((uint32_t)(_x))
|
# define htobe32(_x) ((uint32_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef le32toh
|
||||||
# define le32toh(_x) __builtin_bswap32(_x)
|
# define le32toh(_x) __builtin_bswap32(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef be32toh
|
||||||
# define be32toh(_x) ((uint32_t)(_x))
|
# define be32toh(_x) ((uint32_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef htole64
|
||||||
# define htole64(_x) __builtin_bswap64(_x)
|
# define htole64(_x) __builtin_bswap64(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef htobe64
|
||||||
# define htobe64(_x) ((uint64_t)(_x))
|
# define htobe64(_x) ((uint64_t)(_x))
|
||||||
|
# endif
|
||||||
|
# ifndef le64toh
|
||||||
# define le64toh(_x) __builtin_bswap64(_x)
|
# define le64toh(_x) __builtin_bswap64(_x)
|
||||||
|
# endif
|
||||||
|
# ifndef be64toh
|
||||||
# define be64toh(_x) ((uint64_t)(_x))
|
# define be64toh(_x) ((uint64_t)(_x))
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# error "Byte order not supported"
|
# error "Byte order not supported"
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user