Added LWIP_PLATFORM_BYTESWAP optimalisation flag and macro glue.

This commit is contained in:
christiaans
2006-03-29 10:15:43 +00:00
parent d9b4ab1658
commit 94abf9d935
3 changed files with 31 additions and 4 deletions

View File

@@ -64,12 +64,16 @@ char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reent
#undef ntohl
#endif /* ntohl */
#ifndef LWIP_PLATFORM_BYTESWAP
#define LWIP_PLATFORM_BYTESWAP 0
#endif
#if BYTE_ORDER == BIG_ENDIAN
#define htons(x) (x)
#define ntohs(x) (x)
#define htonl(x) (x)
#define ntohl(x) (x)
#else
#else /* BYTE_ORDER != BIG_ENDIAN */
#ifdef LWIP_PREFIX_BYTEORDER_FUNCS
/* workaround for naming collisions on some platforms */
#define htons lwip_htons
@@ -77,11 +81,19 @@ char *inet_ntoa(struct in_addr addr); /* returns ptr to static buffer; not reent
#define htonl lwip_htonl
#define ntohl lwip_ntohl
#endif
#if LWIP_PLATFORM_BYTESWAP
#define htons(x) LWIP_PLATFORM_HTONS(x)
#define ntohs(x) LWIP_PLATFORM_HTONS(x)
#define htonl(x) LWIP_PLATFORM_HTONL(x)
#define ntohl(x) LWIP_PLATFORM_HTONL(x)
#else
u16_t htons(u16_t x);
u16_t ntohs(u16_t x);
u32_t htonl(u32_t x);
u32_t ntohl(u32_t x);
#endif
#endif
#endif /* __LWIP_INET_H__ */