Infineon Logo AIROC BTSDK v4.0 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Generic Helper Macros

Macros

#define MIN(x, y)   ((x) < (y) ? (x) : (y))
 Macro to get the minimum from 2 arguments.
 
#define MAX(x, y)   ((x) > (y) ? (x) : (y))
 Macro to get the maximum from 2 arguments.
 
#define _countof(x)   (sizeof(x) / sizeof(x[0]))
 Determine the number of elements in an array. More...
 
#define WICED_SWAP16(val)
 Macro to reverse bytes in a 16-bit value. More...
 
#define WICED_SWAP32(val)
 Macro to reverse bytes in a 32-bit value. More...
 
#define WICED_SWAP64(val)
 Macro to reverse bytes in a 64-bit value. More...
 
#define WICED_NTOH16(val)
 Load 16-bit value from unaligned big-endian byte array. More...
 
#define WICED_NTOH32(val)
 Load 32-bit value from unaligned big-endian byte array. More...
 
#define WICED_NTOH64(val)
 Load 64-bit value from unaligned big-endian byte array. More...
 

Detailed Description

Macro Definition Documentation

#define _countof (   x)    (sizeof(x) / sizeof(x[0]))

Determine the number of elements in an array.

#define WICED_NTOH16 (   val)
Value:
((uint16_t)( \
((uint16_t)((val)[0]) << 8) | \
((uint16_t)((val)[1]))))

Load 16-bit value from unaligned big-endian byte array.

#define WICED_NTOH32 (   val)
Value:
((uint32_t)( \
((uint32_t)((val)[0]) << 24) | \
((uint32_t)((val)[1]) << 16) | \
((uint32_t)((val)[2]) << 8) | \
((uint32_t)((val)[3]))))

Load 32-bit value from unaligned big-endian byte array.

#define WICED_NTOH64 (   val)
Value:
((uint64_t)( \
((uint64_t)((val)[0]) << 56) | \
((uint64_t)((val)[1]) << 48) | \
((uint64_t)((val)[2]) << 40) | \
((uint64_t)((val)[3]) << 32) | \
((uint64_t)((val)[4]) << 24) | \
((uint64_t)((val)[5]) << 16) | \
((uint64_t)((val)[6]) << 8) | \
((uint64_t)((val)[7]))))

Load 64-bit value from unaligned big-endian byte array.

#define WICED_SWAP16 (   val)
Value:
((uint16_t)((((uint16_t)(val) & (uint16_t)0x00ffU) << 8) | \
(((uint16_t)(val) & (uint16_t)0xff00U) >> 8)))

Macro to reverse bytes in a 16-bit value.

#define WICED_SWAP32 (   val)
Value:
((uint32_t)((((uint32_t)(val) & (uint32_t)0x000000ffU) << 24) | \
(((uint32_t)(val) & (uint32_t)0x0000ff00U) << 8) | \
(((uint32_t)(val) & (uint32_t)0x00ff0000U) >> 8) | \
(((uint32_t)(val) & (uint32_t)0xff000000U) >> 24)))

Macro to reverse bytes in a 32-bit value.

#define WICED_SWAP64 (   val)
Value:
((uint64_t)( \
(((uint64_t)(val) & (uint64_t)0x00000000000000ffllU) << 56) | \
(((uint64_t)(val) & (uint64_t)0x000000000000ff00llU) << 40) | \
(((uint64_t)(val) & (uint64_t)0x0000000000ff0000llU) << 24) | \
(((uint64_t)(val) & (uint64_t)0x00000000ff000000llU) << 8) | \
(((uint64_t)(val) & (uint64_t)0x000000ff00000000llU) >> 8) | \
(((uint64_t)(val) & (uint64_t)0x0000ff0000000000llU) >> 24) | \
(((uint64_t)(val) & (uint64_t)0x00ff000000000000llU) >> 40) | \
(((uint64_t)(val) & (uint64_t)0xff00000000000000llU) >> 56)))

Macro to reverse bytes in a 64-bit value.