提交 ca52df2f 创建 作者: Silas Boyd-Wickizer's avatar Silas Boyd-Wickizer

Define our own htonx so userspace doesn't have to compile lwIP .cc files

上级 52e1e4af
...@@ -40,4 +40,23 @@ typedef uptr mem_ptr_t; ...@@ -40,4 +40,23 @@ typedef uptr mem_ptr_t;
#define BYTE_ORDER LITTLE_ENDIAN #define BYTE_ORDER LITTLE_ENDIAN
#endif #endif
// We define our own htonx so we can use them in userspace without
// compiling any lwIP .cc files (otherwise we must compile core/def.c).
#define LWIP_PLATFORM_BYTESWAP 1
static inline u16_t
LWIP_PLATFORM_HTONS(u16_t n)
{
return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
}
static inline u32_t
LWIP_PLATFORM_HTONL(u32_t n)
{
return ((n & 0xff) << 24) |
((n & 0xff00) << 8) |
((n & 0xff0000UL) >> 8) |
((n & 0xff000000UL) >> 24);
}
#endif #endif
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论