Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inet implementations assume BYTE_ORDER is defined. make sure that it is #26460

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/inet/arpa-inet-compatibility.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#else // !CHIP_SYSTEM_CONFIG_USE_SOCKETS

#if CHIP_SYSTEM_CONFIG_USE_LWIP

#include <lwip/def.h>
#include <lwip/opt.h>

Expand All @@ -49,7 +48,11 @@

#if CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT

#if BYTE_ORDER == BIG_ENDIAN
#ifndef __BYTE_ORDER__
#error Endianness is not defined
#endif // BYTE_ORDER

#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#ifndef htons
#define htons(x) (x)
#endif
Expand All @@ -63,7 +66,7 @@
#define ntohl(x) (x)
#endif

#else // BYTE_ORDER != BIG_ENDIAN
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#ifndef htons
#define htons(x) ((u16_t)((((x) & (u16_t) 0x00ffU) << 8) | (((x) & (u16_t) 0xff00U) >> 8)))
#endif
Expand All @@ -78,7 +81,10 @@
#ifndef ntohl
#define ntohl(x) htonl(x)
#endif
#endif // BYTE_ORDER == BIG_ENDIAN

#else
#error __BYTE_ORDER__ value not recognized
#endif // __BYTE_ORDER__ ==

#endif // CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT

Expand Down