00001 00002 /* 00003 * Copyright (c) 2006-2010 by Roland Riegel <feedback@roland-riegel.de> 00004 * 00005 * This file is free software; you can redistribute it and/or modify 00006 * it under the terms of either the GNU General Public License version 2 00007 * or the GNU Lesser General Public License version 2.1, both as 00008 * published by the Free Software Foundation. 00009 */ 00010 00011 #include "byteordering.h" 00012 00013 /** 00014 * \addtogroup byteordering 00015 * 00016 * Architecture-dependent handling of byte-ordering. 00017 * 00018 * @{ 00019 */ 00020 /** 00021 * \file 00022 * Byte-order handling implementation (license: GPLv2 or LGPLv2.1) 00023 * 00024 * \author Roland Riegel 00025 */ 00026 00027 #if DOXYGEN || !(LITTLE_ENDIAN || __AVR__) 00028 /** 00029 * Converts a 16-bit integer to little-endian byte order. 00030 * 00031 * Use this function on variable values instead of the 00032 * macro HTOL16(). This saves code size. 00033 * 00034 * \param[in] h A 16-bit integer in host byte order. 00035 * \returns The given 16-bit integer converted to little-endian byte order. 00036 */ 00037 uint16_t htol16(uint16_t h) 00038 { 00039 return HTOL16(h); 00040 } 00041 #endif 00042 00043 #if DOXYGEN || !(LITTLE_ENDIAN || __AVR__) 00044 /** 00045 * Converts a 32-bit integer to little-endian byte order. 00046 * 00047 * Use this function on variable values instead of the 00048 * macro HTOL32(). This saves code size. 00049 * 00050 * \param[in] h A 32-bit integer in host byte order. 00051 * \returns The given 32-bit integer converted to little-endian byte order. 00052 */ 00053 uint32_t htol32(uint32_t h) 00054 { 00055 return HTOL32(h); 00056 } 00057 #endif 00058 00059 /** 00060 * @} 00061 */ 00062
1.5.6