X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/0063f721173b38155648a4267703825fb136fc3e..9e34144c9b7454ab69215c17d75a8ba2dcdcb929:/LUFA/Common/Common.h?ds=inline diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h index 5f1b2eae5..a59a213a8 100644 --- a/LUFA/Common/Common.h +++ b/LUFA/Common/Common.h @@ -164,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 - 1) = Temp; + uint8_t Temp = *CurrDataPos; + *CurrDataPos = *(CurrDataPos + Bytes - 1); + *(CurrDataPos + Bytes - 1) = Temp; - Data++; + CurrDataPos++; Bytes -= 2; } }