LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Endianness.h File Reference

Go to the source code of this file.

Macros

#define SWAPENDIAN_16(x)   (uint16_t)((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
 
#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
 
static uint32_t SwapEndian_32 (const uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST
 
static void SwapEndian_n (void *const Data, uint8_t Length) ATTR_NON_NULL_PTR_ARG(1)