From 0c0607381950c3169c7f3fc3eae8ed1b0ffb1ffd Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Thu, 6 Oct 2016 09:26:59 +0200 Subject: [PATCH] Avoid code duplication in def.c --- src/core/def.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core/def.c b/src/core/def.c index c0cfba3b..68137ed6 100644 --- a/src/core/def.c +++ b/src/core/def.c @@ -62,7 +62,7 @@ u16_t lwip_htons(u16_t n) { - return ((n & 0xff) << 8) | ((n & 0xff00) >> 8); + return (u16_t)PP_HTONS(n); } /** @@ -86,10 +86,7 @@ lwip_ntohs(u16_t n) u32_t lwip_htonl(u32_t n) { - return ((n & 0xff) << 24) | - ((n & 0xff00) << 8) | - ((n & 0xff0000UL) >> 8) | - ((n & 0xff000000UL) >> 24); + return (u32_t)PP_HTONL(n); } /**