From de5d469f2dcf46a7bc31d71ba3abb078517b012d Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Wed, 6 Mar 2019 00:36:38 +0100 Subject: [PATCH] Conform to libc headers for htons and ntohs functions returning uint16_t --- include/core/lpc_core.h | 4 ++-- include/lib/utils.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/core/lpc_core.h b/include/core/lpc_core.h index 10ae431..26e7bd7 100644 --- a/include/core/lpc_core.h +++ b/include/core/lpc_core.h @@ -205,9 +205,9 @@ static inline uint32_t double_byte_swap_16(volatile uint32_t value) return result; } /* Change endianness of a 16-bit halfword */ -static inline uint32_t byte_swap_16(volatile uint16_t value) +static inline uint16_t byte_swap_16(volatile uint16_t value) { - uint32_t result = 0; + uint16_t result = 0; __asm volatile ("rev16 %0, %1" : "=l" (result) : "l" (value)); return (result & 0xFFFF); } diff --git a/include/lib/utils.h b/include/lib/utils.h index 2219970..29e5e7b 100644 --- a/include/lib/utils.h +++ b/include/lib/utils.h @@ -61,8 +61,8 @@ uint8_t bits_set(uint32_t x); static inline uint32_t ntohl(uint32_t val) __attribute__ ((alias ("byte_swap_32"))); static inline uint32_t htonl(uint32_t val) __attribute__ ((alias ("byte_swap_32"))); /* Short versions */ -static inline uint32_t ntohs(uint32_t val) __attribute__ ((alias ("byte_swap_16"))); -static inline uint32_t htons(uint32_t val) __attribute__ ((alias ("byte_swap_16"))); +static inline uint16_t ntohs(uint32_t val) __attribute__ ((alias ("byte_swap_16"))); +static inline uint16_t htons(uint32_t val) __attribute__ ((alias ("byte_swap_16"))); /* MIN and MAX */ -- 2.43.0