ReactOS  0.4.15-dev-3428-g0609db5
net_wh.h
Go to the documentation of this file.
1 #pragma once
2 
3 #if defined(i386) || defined(_AMD64_) || defined(_ARM_)
4 
5 /* DWORD network to host byte order conversion for i386 */
6 #define DN2H(dw) \
7  ((((dw) & 0xFF000000L) >> 24) | \
8  (((dw) & 0x00FF0000L) >> 8) | \
9  (((dw) & 0x0000FF00L) << 8) | \
10  (((dw) & 0x000000FFL) << 24))
11 
12 /* DWORD host to network byte order conversion for i386 */
13 #define DH2N(dw) \
14  ((((dw) & 0xFF000000L) >> 24) | \
15  (((dw) & 0x00FF0000L) >> 8) | \
16  (((dw) & 0x0000FF00L) << 8) | \
17  (((dw) & 0x000000FFL) << 24))
18 
19 /* WORD network to host order conversion for i386 */
20 #define WN2H(w) \
21  ((((w) & 0xFF00) >> 8) | \
22  (((w) & 0x00FF) << 8))
23 
24 /* WORD host to network byte order conversion for i386 */
25 #define WH2N(w) \
26  ((((w) & 0xFF00) >> 8) | \
27  (((w) & 0x00FF) << 8))
28 
29 #else /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */
30 
31 /* DWORD network to host byte order conversion for other architectures */
32 #define DN2H(dw) \
33  (dw)
34 
35 /* DWORD host to network byte order conversion for other architectures */
36 #define DH2N(dw) \
37  (dw)
38 
39 /* WORD network to host order conversion for other architectures */
40 #define WN2H(w) \
41  (w)
42 
43 /* WORD host to network byte order conversion for other architectures */
44 #define WH2N(w) \
45  (w)
46 
47 #endif /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */