I remember some time ago, I ran into a problem with "i386" definition
somewhere, because it was used in a structure or something. I would
prefer to use standard definitions as much as possible. And in the case
of Windows code, I would consider MS to be standard. So IMO we should
use _X86_ or _M_IX86 whenever possible.
Am 12.08.2013 03:12, schrieb cgutman(a)svn.reactos.org:
Author: cgutman
Date: Mon Aug 12 01:12:25 2013
New Revision: 59704
URL:
http://svn.reactos.org/svn/reactos?rev=59704&view=rev
Log:
[CMAKE]
- Define i386 on x86 MSVC builds
- Probably fixes the infamous MSVC networking issues caused by tcpip.h assuming it was a
big-endian platform and never byte-swapping anything
[TCPIP][LAN]
- Fix byteswapping on AMD64 and ARM builds too
Modified:
trunk/reactos/CMakeLists.txt
trunk/reactos/drivers/network/lan/include/net_wh.h
trunk/reactos/drivers/network/tcpip/include/tcpip.h
Modified: trunk/reactos/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/CMakeLists.txt?rev=59704&a…
==============================================================================
--- trunk/reactos/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/CMakeLists.txt [iso-8859-1] Mon Aug 12 01:12:25 2013
@@ -142,7 +142,7 @@
# Arch Options
if(ARCH STREQUAL "i386")
- add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
+ add_definitions(-D_M_IX86 -D_X86_ -D__i386__ -Di386)
elseif(ARCH STREQUAL "amd64")
add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
elseif(ARCH STREQUAL "arm")
Modified: trunk/reactos/drivers/network/lan/include/net_wh.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/lan/includ…
==============================================================================
--- trunk/reactos/drivers/network/lan/include/net_wh.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/lan/include/net_wh.h [iso-8859-1] Mon Aug 12 01:12:25
2013
@@ -1,6 +1,6 @@
#pragma once
-#ifdef i386
+#if defined(i386) || defined(_AMD64_) || defined(_ARM_)
/* DWORD network to host byte order conversion for i386 */
#define DN2H(dw) \
@@ -26,7 +26,7 @@
((((w) & 0xFF00) >> 8) | \
(((w) & 0x00FF) << 8))
-#else /* i386 */
+#else /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */
/* DWORD network to host byte order conversion for other architectures */
#define DN2H(dw) \
@@ -44,4 +44,4 @@
#define WH2N(w) \
(w)
-#endif /* i386 */
+#endif /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */
Modified: trunk/reactos/drivers/network/tcpip/include/tcpip.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/include/tcpip.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/include/tcpip.h [iso-8859-1] Mon Aug 12 01:12:25
2013
@@ -65,7 +65,7 @@
#define NDIS_BUFFER_TAG FOURCC('n','b','u','f')
#define NDIS_PACKET_TAG FOURCC('n','p','k','t')
-#ifdef i386
+#if defined(i386) || defined(_AMD64_) || defined(_ARM_)
/* DWORD network to host byte order conversion for i386 */
#define DN2H(dw) \
@@ -91,7 +91,7 @@
((((w) & 0xFF00) >> 8) | \
(((w) & 0x00FF) << 8))
-#else /* i386 */
+#else /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */
#error Unsupported architecture
@@ -111,7 +111,7 @@
#define WH2N(w) \
(w)
-#endif /* i386 */
+#endif /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */
/* AF_INET and other things Arty likes to use ;) */
#define AF_INET 2