LUFA Library
Endianness.h File Reference

Endianness and Byte Ordering macros and functions. More...

Macros

#define SWAPENDIAN_16(x)
 
#define SWAPENDIAN_32(x)
 
Run-time endianness conversion
#define le16_to_cpu(x)   (x)
 
#define le32_to_cpu(x)   (x)
 
#define be16_to_cpu(x)   SwapEndian_16(x)
 
#define be32_to_cpu(x)   SwapEndian_32(x)
 
#define cpu_to_le16(x)   (x)
 
#define cpu_to_le32(x)   (x)
 
#define cpu_to_be16(x)   SwapEndian_16(x)
 
#define cpu_to_be32(x)   SwapEndian_32(x)
 
Compile-time endianness conversion
#define LE16_TO_CPU(x)   (x)
 
#define LE32_TO_CPU(x)   (x)
 
#define BE16_TO_CPU(x)   SWAPENDIAN_16(x)
 
#define BE32_TO_CPU(x)   SWAPENDIAN_32(x)
 
#define CPU_TO_LE16(x)   (x)
 
#define CPU_TO_LE32(x)   (x)
 
#define CPU_TO_BE16(x)   SWAPENDIAN_16(x)
 
#define CPU_TO_BE32(x)   SWAPENDIAN_32(x)
 

Functions

static uint16_t SwapEndian_16 (const uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE
 
static uint32_t SwapEndian_32 (const uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE
 
static void SwapEndian_n (void *const Data, uint8_t Length) ATTR_NON_NULL_PTR_ARG(1)
 

Detailed Description

Common library convenience macros and functions relating to byte (re-)ordering.