diff --git a/headers/posix/endian.h b/headers/posix/endian.h index 02b5c329f8..ba93bb128a 100644 --- a/headers/posix/endian.h +++ b/headers/posix/endian.h @@ -7,9 +7,7 @@ #include -#ifdef _BSD_SOURCE -#include -#endif + /* Defines architecture dependent endian constants. * The constant reflects the byte order, "4" is the most @@ -30,49 +28,4 @@ #define __LITTLE_ENDIAN LITTLE_ENDIAN #define __BYTE_ORDER BYTE_ORDER -#ifdef _BSD_SOURCE - -/* - * General byte order swapping functions. - */ -#define bswap16(x) __swap_int16(x) -#define bswap32(x) __swap_int32(x) -#define bswap64(x) __swap_int64(x) - -/* - * Host to big endian, host to little endian, big endian to host, and little - * endian to host byte order functions as detailed in byteorder(9). - */ -#if BYTE_ORDER == LITTLE_ENDIAN -#define htobe16(x) bswap16((x)) -#define htobe32(x) bswap32((x)) -#define htobe64(x) bswap64((x)) -#define htole16(x) ((uint16_t)(x)) -#define htole32(x) ((uint32_t)(x)) -#define htole64(x) ((uint64_t)(x)) - -#define be16toh(x) bswap16((x)) -#define be32toh(x) bswap32((x)) -#define be64toh(x) bswap64((x)) -#define le16toh(x) ((uint16_t)(x)) -#define le32toh(x) ((uint32_t)(x)) -#define le64toh(x) ((uint64_t)(x)) -#else /* BYTE_ORDER != LITTLE_ENDIAN */ -#define htobe16(x) ((uint16_t)(x)) -#define htobe32(x) ((uint32_t)(x)) -#define htobe64(x) ((uint64_t)(x)) -#define htole16(x) bswap16((x)) -#define htole32(x) bswap32((x)) -#define htole64(x) bswap64((x)) - -#define be16toh(x) ((uint16_t)(x)) -#define be32toh(x) ((uint32_t)(x)) -#define be64toh(x) ((uint64_t)(x)) -#define le16toh(x) bswap16((x)) -#define le32toh(x) bswap32((x)) -#define le64toh(x) bswap64((x)) -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - -#endif /* _BSD_SOURCE */ - #endif /* _ENDIAN_H_ */