Commit 043cc419 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

lib: use WRPC-provided implementation of htonll(). Also, fix incorrect detection…

lib: use WRPC-provided implementation of htonll(). Also, fix incorrect detection of WRS target macro
parent 4dc46ae2
......@@ -18,21 +18,24 @@ extern uint32_t __div64_32(uint64_t *n, uint32_t base);
extern char *format_hex8(char *s, const unsigned char *mac);
extern char *format_mac(char *s, const unsigned char *mac);
#if defined (__BYTE_ORDER__) && defined (__ORDER_LITTLE_ENDIAN__) && defined (__ORDER_BIG_ENDIAN__)
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# ifdef CONFIG_ARCH_WRS
# define htonll(x) htobe64(x)
# define ntohll(x) be64toh(x)
# else
# define htonll(x) __builtin_bswap64(x)
# define ntohll(x) __builtin_bswap64(x)
# endif
# else
# define htonll(x) (x)
# define ntohll(x) (x)
# if !defined (__BYTE_ORDER__) || !defined (__ORDER_LITTLE_ENDIAN__) || !defined (__ORDER_BIG_ENDIAN__)
# error "unsupported compiler (no __BYTE_ORDER__ macro definition)"
# endif
#else
# error "unsupported compiler"
/* WRPC provides its own htonll/ntohll implementation. Don't try to reinvent the wheel. */
#ifndef CONFIG_ARCH_IS_WRPC
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# ifdef CONFIG_ARCH_IS_WRS
# define htonll(x) htobe64(x)
# define ntohll(x) be64toh(x)
# else
# define htonll(x) __builtin_bswap64(x)
# define ntohll(x) __builtin_bswap64(x)
# endif
# else
# define htonll(x) (x)
# define ntohll(x) (x)
# endif
#endif
#endif /* __PPSI_LIB_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment