Digi XBee(R) ANSI C Host Library
Macros | Functions
byteorder.h File Reference
#include <string.h>
#include "xbee/platform.h"

Go to the source code of this file.

Macros

#define memcpy_letoh(dst, src_le, count)   _f_memcpy( dst, src_le, count)
 Copy count bytes in little-endian byte order from src_le to dst in host byte order (equivalent to memcpy() on little-endian platforms).
 
#define memcpy_htole(dst_le, src, count)   _f_memcpy( dst_le, src, count)
 Copy count bytes in host byte order from src to dst_le in little-endian byte order (equivalent to memcpy() on little-endian platforms).
 
#define memcpy_betoh(dst, src_be, count)   _swapcpy( dst, src_be, count)
 Copy count bytes in big-endian byte order from src_be to dst in host byte order (equivalent to memcpy() on big-endian platforms).
 
#define memcpy_htobe(dst_be, src, count)   _swapcpy( dst_be, src, count)
 Copy count bytes in host byte order from src to dst_be in big-endian byte order (equivalent to memcpy() on big-endian platforms).
 
#define memcpy_betole(dst_le, src_be, count)   _swapcpy( dst_le, src_be, count)
 Copy count bytes in big-endian byte order from src_be to dst_le in little-endian byte order (always swaps byte order).
 
#define memcpy_letobe(dst_be, src_le, count)   _swapcpy( dst_be, src_le, count)
 Copy count bytes in little-endian byte order from src_le to dst_be in big-endian byte order (always swaps byte order).
 
#define htobe16(x)   swap16(x)
 Convert a uint16_t in host byte order to big-endian byte order.
 
#define htobe32(x)   swap32(x)
 Convert a uint32_t in host byte order to big-endian byte order.
 
#define be16toh(x)   swap16(x)
 Convert a uint16_t in big-endian byte order to host byte order.
 
#define be32toh(x)   swap32(x)
 Convert a uint32_t in big-endian byte order to host byte order.
 
#define htole16(x)   (x)
 Convert a uint16_t in host byte order to little-endian byte order.
 
#define htole32(x)   (x)
 Convert a uint32_t in host byte order to little-endian byte order.
 
#define le16toh(x)   (x)
 Convert a uint16_t in little-endian byte order to host byte order.
 
#define le32toh(x)   (x)
 Convert a uint32_t in little-endian byte order to host byte order.
 

Functions

uint16_t swap16 (uint16_t value)
 Swap the byte order of a 16-bit value. More...
 
uint32_t swap32 (uint32_t value)
 Swap the byte order of a 32-bit value. More...
 
void _swapcpy (void FAR *dst, const void FAR *src, uint_fast8_t count)
 Function similar to memcpy() but reverses byte order during copy. Copy count from src to dst while reversing the order. Assumes that src and dst do not overlap. More...