1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-13 11:01:50 +00:00
openmptcprouter-feeds/mptcpd/patches/endian.patch

20 lines
735 B
Diff
Raw Normal View History

2022-07-24 16:32:24 +00:00
--- a/include/mptcpd/private/sockaddr.h 2022-07-24 18:29:37.995613204 +0200
+++ b/include/mptcpd/private/sockaddr.h 2022-07-24 18:30:53.802312010 +0200
@@ -24,6 +24,16 @@
* These macros may be used in place of @c htons() or @c htonl() when
* initializing an IPv4 address or IP port constant at compile-time.
*/
+#ifndef __bswap_constant_16
+#define __bswap_constant_16(x) \
+ ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+#endif
+#ifndef __bswap_constant_32
+#define __bswap_constant_32(x) \
+ ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) \
+ | (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
+#endif
+
///@{
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define MPTCPD_CONSTANT_HTONS(hs) __bswap_constant_16(hs)