Hi,
It turns out that these are inline functions, here is a new patch.
xan
________________________________
From: Michel Zou
Sent: Monday, August 9, 2021 5:18 PM
To: LIU Hao <lh_mo...@126.com>; mingw-w64-public@lists.sourceforge.net 
<mingw-w64-public@lists.sourceforge.net>
Subject: Re: [Mingw-w64-public] patch to add htonll/ntohll

I have no idea, I removed them if you think its unavailable.




________________________________
From: LIU Hao
Sent: Monday, August 9, 2021 5:02 PM
To: Michel Zou; mingw-w64-public@lists.sourceforge.net
Subject: Re: [Mingw-w64-public] patch to add htonll/ntohll

在 2021-08-09 21:20, Michel Zou 写道:
> diff --git a/mingw-w64-crt/libce/winsock.def b/mingw-w64-crt/libce/winsock.def
> index c9e2e958d..a75b84c69 100644
> --- a/mingw-w64-crt/libce/winsock.def
> +++ b/mingw-w64-crt/libce/winsock.def

The `#if` guards are okay. However, changes to libce are highly dubious; do you 
have any reliable
sources about whether these functions are available on Windows CE? AFAICT 
Windows CE predates
Windows 8 and probably hasn't got them.


--
Best regards,
LIU Hao

diff --git a/mingw-w64-headers/include/winsock2.h b/mingw-w64-headers/include/winsock2.h
index 0697e8c2a..fce0729b5 100644
--- a/mingw-w64-headers/include/winsock2.h
+++ b/mingw-w64-headers/include/winsock2.h
@@ -1011,6 +1011,9 @@ typedef unsigned int GROUP;
 #ifndef __INSIDE_CYGWIN__
   WINSOCK_API_LINKAGE u_long WSAAPI htonl(u_long hostlong);
   WINSOCK_API_LINKAGE u_short WSAAPI htons(u_short hostshort);
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
+  __forceinline unsigned __int64 htonll(unsigned __int64 Value) { return (((unsigned __int64)htonl(Value & 0xFFFFFFFFUL)) << 32) | htonl((u_long)(Value >> 32)); }
+#endif
 #endif /* !__INSIDE_CYGWIN__ */
   WINSOCK_API_LINKAGE unsigned __LONG32 WSAAPI inet_addr(const char *cp);
   WINSOCK_API_LINKAGE char *WSAAPI inet_ntoa(struct in_addr in);
@@ -1018,6 +1021,9 @@ typedef unsigned int GROUP;
 #ifndef __INSIDE_CYGWIN__
   WINSOCK_API_LINKAGE u_long WSAAPI ntohl(u_long netlong);
   WINSOCK_API_LINKAGE u_short WSAAPI ntohs(u_short netshort);
+#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
+  __forceinline unsigned __int64 ntohll(unsigned __int64 Value) { return (((unsigned __int64)ntohl(Value & 0xFFFFFFFFUL)) << 32) | ntohl((u_long)(Value >> 32)); }
+#endif
 #endif /* !__INSIDE_CYGWIN__ */
   WINSOCK_API_LINKAGE int WSAAPI recv(SOCKET s,char *buf,int len,int flags);
   WINSOCK_API_LINKAGE int WSAAPI recvfrom(SOCKET s,char *buf,int len,int flags,struct sockaddr *from,int *fromlen);
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to