32/64-bit UNDI Specification
Version 1.02 12/12/00 389
G.3.1.6 PXE_SWAP_UINT64This macro swaps bytes in a 64-bit word for compilers that support 64-bit words.
#if PXE_UINT64_SUPPORT != 0
# ifdef PXE_INTEL_ORDER
# define PXE_SWAP_UINT64(n) \
((((PXE_UINT64)(n) & 0x00000000000000FF) << 56) |\
(((PXE_UINT64)(n) & 0x000000000000FF00) << 40) | \
(((PXE_UINT64)(n) & 0x0000000000FF0000) << 24) | \
(((PXE_UINT64)(n) & 0x00000000FF000000) << 8) | \
(((PXE_UINT64)(n) & 0x000000FF00000000) >> 8) | \
(((PXE_UINT64)(n) & 0x0000FF0000000000) >> 24) | \
(((PXE_UINT64)(n) & 0x00FF000000000000) >> 40) | \
(((PXE_UINT64)(n) & 0xFF00000000000000) >> 56)
# else
# define PXE_SWAP_UINT64(n) (n)
# endif
#endif // PXE_UINT64_SUPPORT
This macro swaps bytes in a 64-bit word, in place, for compilers that do not support 64-bit words.
This version of the 64-bit swap macro cannot be used in expressions.
#if PXE_NO_UINT64_SUPPORT != 0
# if PXE_INTEL_ORDER
# define PXE_SWAP_UINT64(n) \
{ \
PXE_UINT32 tmp = (PXE_UINT64)(n)[1]; \
(PXE_UINT64)(n)[1] = PXE_SWAP_UINT32((PXE_UINT64)(n)[0]); \
(PXE_UINT64)(n)[0] = PXE_SWAP_UINT32(tmp); \
}
# else
# define PXE_SWAP_UINT64(n) (n)
# endif
#endif // PXE_NO_UINT64_SUPPORT