Macros and functions for forced byte reordering.
More...
#define SWAPENDIAN_16 |
( |
|
x | ) |
|
Swaps the byte ordering of a 16-bit value at compile-time. Do not use this macro for swapping byte orderings of dynamic values computed at runtime, use SwapEndian_16() instead. The result of this macro can be used inside struct or other variable initializers outside of a function, something that is not possible with the inline function variant.
- Parameters
-
[in] | x | 16-bit value whose byte ordering is to be swapped. |
- Returns
- Input value with the byte ordering reversed.
#define SWAPENDIAN_32 |
( |
|
x | ) |
|
Swaps the byte ordering of a 32-bit value at compile-time. Do not use this macro for swapping byte orderings of dynamic values computed at runtime- use SwapEndian_32() instead. The result of this macro can be used inside struct or other variable initializers outside of a function, something that is not possible with the inline function variant.
- Parameters
-
[in] | x | 32-bit value whose byte ordering is to be swapped. |
- Returns
- Input value with the byte ordering reversed.
static uint16_t SwapEndian_16 |
( |
const uint16_t |
Word | ) |
|
|
inlinestatic |
Function to reverse the byte ordering of the individual bytes in a 16 bit value.
- Parameters
-
[in] | Word | Word of data whose bytes are to be swapped. |
- Returns
- Input data with the individual bytes reversed.
static uint32_t SwapEndian_32 |
( |
const uint32_t |
DWord | ) |
|
|
inlinestatic |
Function to reverse the byte ordering of the individual bytes in a 32 bit value.
- Parameters
-
[in] | DWord | Double word of data whose bytes are to be swapped. |
- Returns
- Input data with the individual bytes reversed.
static void SwapEndian_n |
( |
void *const |
Data, |
|
|
uint8_t |
Length |
|
) |
| |
|
inlinestatic |
Function to reverse the byte ordering of the individual bytes in a n byte value.
- Parameters
-
[in,out] | Data | Pointer to a number containing an even number of bytes to be reversed. |
[in] | Length | Length of the data in bytes. |
- Returns
- Input data with the individual bytes reversed.