All these functions are using 16-bits arguments and results.
{
uint16_t result = 0;
__asm volatile ("rev16 %0, %1" : "=l" (result) : "l" (value));
- return (result & 0xFFFF);
+ return result;
}
/* Change endianness of a 32-bit word */
static inline uint32_t byte_swap_32(volatile uint32_t value)
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 uint16_t ntohs(uint32_t val) __attribute__ ((alias ("byte_swap_16")));
-static inline uint16_t htons(uint32_t val) __attribute__ ((alias ("byte_swap_16")));
+static inline uint16_t ntohs(uint16_t val) __attribute__ ((alias ("byte_swap_16")));
+static inline uint16_t htons(uint16_t val) __attribute__ ((alias ("byte_swap_16")));
/* MIN and MAX */