From b31b0c814882bddfb83819655e32bdf68d6873f3 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 7 Dec 2016 12:44:57 +0100 Subject: [PATCH] remove bogus LWIP_MAKE_U16() define and use PP_NTOHS() in ip4.c instead --- src/core/ipv4/ip4.c | 4 ++-- src/include/lwip/def.h | 7 ------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/core/ipv4/ip4.c b/src/core/ipv4/ip4.c index b72afab1..2e2ce4bd 100644 --- a/src/core/ipv4/ip4.c +++ b/src/core/ipv4/ip4.c @@ -863,7 +863,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d IPH_TTL_SET(iphdr, ttl); IPH_PROTO_SET(iphdr, proto); #if CHECKSUM_GEN_IP_INLINE - chk_sum += LWIP_MAKE_U16(proto, ttl); + chk_sum += PP_NTOHS(proto | (ttl << 8)); #endif /* CHECKSUM_GEN_IP_INLINE */ /* dest cannot be NULL here */ @@ -876,7 +876,7 @@ ip4_output_if_opt_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *d IPH_VHL_SET(iphdr, 4, ip_hlen / 4); IPH_TOS_SET(iphdr, tos); #if CHECKSUM_GEN_IP_INLINE - chk_sum += LWIP_MAKE_U16(tos, iphdr->_v_hl); + chk_sum += PP_NTOHS(tos | (iphdr->_v_hl << 8)); #endif /* CHECKSUM_GEN_IP_INLINE */ IPH_LEN_SET(iphdr, lwip_htons(p->tot_len)); #if CHECKSUM_GEN_IP_INLINE diff --git a/src/include/lwip/def.h b/src/include/lwip/def.h index bb07009c..befc4fb7 100644 --- a/src/include/lwip/def.h +++ b/src/include/lwip/def.h @@ -65,13 +65,6 @@ extern "C" { #endif #endif -/* Endianess-optimized shifting of two u8_t to create one u16_t */ -#if BYTE_ORDER == LITTLE_ENDIAN -#define LWIP_MAKE_U16(a, b) ((a << 8) | b) -#else -#define LWIP_MAKE_U16(a, b) ((b << 8) | a) -#endif - #if BYTE_ORDER == BIG_ENDIAN #define lwip_htons(x) (x) #define lwip_ntohs(x) (x)