X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/7f9f97c792dee6875fbca9806422bdd7d6c5a657..3d28d53c3e2ae529933283e63a8b05f2ab1ce2be:/LUFA/Common/Common.h?ds=inline diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index 2b57cda91..a59a213a8 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -29,9 +29,10 @@ */ /** \file + * \brief Common library convenience macros and functions. * * This file contains macros which are common to all library elements, and which may be useful in user code. It - * also includes other common headers, such as Atomic.h, FunctionAttributes.h and BoardTypes.h. + * also includes other common headers, such as Atomic.h, Attributes.h and BoardTypes.h. */ /** @defgroup Group_Common Common Utility Headers - LUFA/Drivers/Common/Common.h @@ -58,7 +59,7 @@ /* Includes: */ #include - #include "FunctionAttributes.h" + #include "Attributes.h" #include "BoardTypes.h" /* Public Interface - May be used in end-application: */ @@ -163,18 +164,18 @@ * \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed * \param[in] Bytes Length of the data in bytes */ - static inline void SwapEndian_n(uint8_t* Data, uint8_t Bytes); - static inline void SwapEndian_n(uint8_t* Data, uint8_t Bytes) + static inline void SwapEndian_n(void* Data, uint8_t Bytes); + static inline void SwapEndian_n(void* Data, uint8_t Bytes) { - uint8_t Temp; - + uint8_t* CurrDataPos = Data; + while (Bytes) { - Temp = *Data; - *Data = *(Data + Bytes - 1); - *(Data + Bytes) = Temp; + uint8_t Temp = *CurrDataPos; + *CurrDataPos = *(CurrDataPos + Bytes - 1); + *(CurrDataPos + Bytes - 1) = Temp; - Data++; + CurrDataPos++; Bytes -= 2; } }