include: Allow programs to take the address of byte-swapping functions.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Alex Henrie 2017-08-17 09:11:57 -06:00 committed by Alexandre Julliard
parent 79ebd3f3bf
commit 99684bc425
1 changed files with 16 additions and 8 deletions

View File

@ -519,10 +519,18 @@ int WINAPI __WSAFDIsSet(SOCKET,WS(fd_set)*);
#ifdef WORDS_BIGENDIAN
#define htonl(l) ((ULONG)(l))
#define htons(s) ((u_short)(s))
#define ntohl(l) ((ULONG)(l))
#define ntohs(s) ((u_short)(s))
static inline u_short __wine_ushort_noop(u_short s)
{
return s;
}
static inline ULONG __wine_ulong_noop(ULONG l)
{
return l;
}
#define htonl __wine_ulong_noop
#define htons __wine_ushort_noop
#define ntohl __wine_ulong_noop
#define ntohs __wine_ushort_noop
#else /* WORDS_BIGENDIAN */
@ -534,10 +542,10 @@ static inline ULONG __wine_ulong_swap(ULONG l)
{
return ((ULONG)__wine_ushort_swap((u_short)l) << 16) | __wine_ushort_swap((u_short)(l >> 16));
}
#define htonl(l) __wine_ulong_swap(l)
#define htons(s) __wine_ushort_swap(s)
#define ntohl(l) __wine_ulong_swap(l)
#define ntohs(s) __wine_ushort_swap(s)
#define htonl __wine_ulong_swap
#define htons __wine_ushort_swap
#define ntohl __wine_ulong_swap
#define ntohs __wine_ushort_swap
#endif /* WORDS_BIGENDIAN */