HtoNtoH.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/** @File
Routines for translating between host and network byte-order.
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License that accompanies this
distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <LibConfig.h>
// Undefine macro versions of the functions to be defined below.
/** 32-bit Host to Network byte order conversion.
@param[in] Datum The 32-bit value to be converted.
@return Datum, converted to network byte order.
**/
)
{
#if BYTE_ORDER == LITTLE_ENDIAN
return SwapBytes32(Datum);
#else
return Datum;
#endif
}
/** 16-bit Host to Network byte order conversion.
@param[in] Datum The 16-bit value to be converted.
@return Datum, converted to network byte order.
**/
)
{
#if BYTE_ORDER == LITTLE_ENDIAN
return SwapBytes16(Datum);
#else
return Datum;
#endif
}
/** 32-bit Network to Host byte order conversion.
@param[in] Datum The 16-bit value to be converted.
@return Datum, converted to host byte order.
**/
)
{
#if BYTE_ORDER == LITTLE_ENDIAN
return SwapBytes32(Datum);
#else
return Datum;
#endif
}
/** 16-bit Network to Host byte order conversion.
@param[in] Datum The 16-bit value to be converted.
@return Datum, converted to host byte order.
**/
)
{
#if BYTE_ORDER == LITTLE_ENDIAN
return SwapBytes16(Datum);
#else
return Datum;
#endif
}