Add shortcuts to SwapEndian_16() and SwapEndian_32() internal functions to improve optimization if called with constant inputs.
This commit is contained in:
parent
ef4cff29c3
commit
3478178127
5 changed files with 53 additions and 25 deletions
|
@ -394,6 +394,9 @@
|
|||
static inline uint16_t SwapEndian_16(const uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
|
||||
static inline uint16_t SwapEndian_16(const uint16_t Word)
|
||||
{
|
||||
if (GCC_IS_COMPILE_CONST(Word))
|
||||
return SWAPENDIAN_16(Word);
|
||||
|
||||
uint8_t Temp;
|
||||
|
||||
union
|
||||
|
@ -420,6 +423,9 @@
|
|||
static inline uint32_t SwapEndian_32(const uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST;
|
||||
static inline uint32_t SwapEndian_32(const uint32_t DWord)
|
||||
{
|
||||
if (GCC_IS_COMPILE_CONST(DWord))
|
||||
return SWAPENDIAN_32(DWord);
|
||||
|
||||
uint8_t Temp;
|
||||
|
||||
union
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue