aroarfw
Defines
include/aroarfw/byteorder.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define RBO_H2NB16(buf, v)
 Convert a 16 bit integer into a 2 byte buffer in network byte order.
#define RBO_NB2H16(buf)
 Convert a 2 byte buffer into a 16 bit integer in host byte order.
#define RBO_H2NB32(buf, v)
 Convert a 32 bit integer into a 4 byte buffer in network byte order.
#define RBO_NB2H32(buf)
 Convert a 4 byte buffer into a 32 bit integer in host byte order.

Define Documentation

#define RBO_H2NB16 (   buf,
 
)
Value:
( \
                            ((uint16_t)(((unsigned char*)(buf))[0] = ((uint16_t)(v) >> 8) & 0xFF) << 8) + \
                             (uint16_t)(((unsigned char*)(buf))[1] =  (uint16_t)(v)       & 0xFF) \
                           )

Convert a 16 bit integer into a 2 byte buffer in network byte order.

This function converts a 16 bit integer in host byte order into network byte order and puts it into a 2 byte buffer.

Parameters:
bufThe buffer to put the integer in
vThe integer to put in the buffer
Returns:
The integer in host byte order

Definition at line 37 of file byteorder.h.

#define RBO_H2NB32 (   buf,
 
)
Value:
( \
                            ((uint32_t)(((unsigned char*)(buf))[0] = ((uint32_t)(v) >> 24) & 0xFF) << 24) + \
                            ((uint32_t)(((unsigned char*)(buf))[1] = ((uint32_t)(v) >> 16) & 0xFF) << 16) + \
                            ((uint32_t)(((unsigned char*)(buf))[2] = ((uint32_t)(v) >>  8) & 0xFF) <<  8) + \
                             (uint32_t)(((unsigned char*)(buf))[3] =  (uint32_t)(v)        & 0xFF) \
                           )

Convert a 32 bit integer into a 4 byte buffer in network byte order.

This function converts a 32 bit integer in host byte order into network byte order and puts it into a 4 byte buffer.

Parameters:
bufThe buffer to put the integer in
vThe integer to put in the buffer
Returns:
The integer in host byte order

Definition at line 64 of file byteorder.h.

#define RBO_NB2H16 (   buf)
Value:
( \
                            ((uint16_t)(((unsigned char*)(buf))[0]) << 8) + \
                             (uint16_t)(((unsigned char*)(buf))[1]) \
                           )

Convert a 2 byte buffer into a 16 bit integer in host byte order.

This function converts a 2 byte buffer in network byte order into a 16 bit integer in host byte order.

Parameters:
bufThe buffer to get the integer from
Returns:
The integer in host byte order

Definition at line 50 of file byteorder.h.

#define RBO_NB2H32 (   buf)
Value:
( \
                            ((uint32_t)(((unsigned char*)(buf))[0]) << 24) + \
                            ((uint32_t)(((unsigned char*)(buf))[1]) << 16) + \
                            ((uint32_t)(((unsigned char*)(buf))[2]) <<  8) + \
                             (uint32_t)(((unsigned char*)(buf))[3]) \
                           )

Convert a 4 byte buffer into a 32 bit integer in host byte order.

This function converts a 4 byte buffer in network byte order into a 32 bit integer in host byte order.

Parameters:
bufThe buffer to get the integer from
Returns:
The integer in host byte order

Definition at line 79 of file byteorder.h.