mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-13 19:57:05 +08:00
Added LWIP_PLATFORM_BYTESWAP optimalisation flag and macro glue.
This commit is contained in:
@@ -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__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user