GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBI / V0-1-5 > test_unions / mv2304
#include <PBI/Endianness.h>
#include <UNIONS_BIG_LITTLE>
Classes | |
union | _U_byte |
Accesses an 8 bit quantity as both a signed and unsigned byte. More... | |
struct | _U_short_as_bytes |
Internal structure which sets the ordering for assessing the bytes within a short. More... | |
struct | _U_int_as_shorts |
Internal structure which sets the ordering for assessing the shorts within an int. More... | |
struct | _U_longlong_as_ints |
Internal structure which sets the ordering for assessing the ints within a long long int. More... | |
union | _U_short |
Accesses a 16 bit quantity as narrower integer types (chars). More... | |
union | _U_int |
Accesses a 32 bit quantity as narrower integer types (shorts and chars). More... | |
union | _U_longlong |
Accesses a 64 bit quantity as narrower integer types (ints, shorts and chars). More... | |
Defines | |
#define | _UNIONS_SHORT_AS_BYTES |
Internal use only. | |
#define | U_PACK_SHORT_WITH_BYTES(_hi, _lo) ((((_hi)&0xff) << 8) | (((_lo)&0xff) << 0)) |
Packs a short with the numerically high and low bytes. | |
#define | U_UNPACK_SHORT_LO_BYTE(_us) ((unsigned char)(_us)) |
Extracts the numerically least significant byte from a short. | |
#define | U_UNPACK_SHORT_HI_BYTE(_us) ((unsigned char)((_us) >> 8)) |
Extracts the numerically most significant byte from a short. | |
#define | _UNIONS_INT_AS_SHORTS |
Internal use only. | |
#define | U_PACK_INT_WITH_SHORTS(_hi, _lo) ((((_hi)&0xffff) << 16) | (((_lo)&0xffff) << 0)) |
Packs an int with the numerically high and low shorts. | |
#define | U_PACK_INT_WITH_BYTES(_3, _2, _1, _0) |
Packs an int with the 4 bytes, specified in order from the numerically most significant byte (_3) to the numerically least signicant byte (_0). | |
#define | U_UNPACK_INT_LO_SHORT(_ui) ((unsigned short)(_ui)) |
Extracts the numerically least significant short from an int. | |
#define | U_UNPACK_INT_HI_SHORT(_ui) ((unsigned short)((_ui) >> 16)) |
Extracts the numerically most significant short from an int. | |
#define | _UNIONS_LONGLONG_AS_INTS |
Internal use only. | |
#define | U_PACK_LL_WITH_INTS(_hi, _lo) |
Packs a long long int with the numerically high and low ints. | |
#define | U_UNPACK_LL_HI_INT(_ull) ((unsigned int)((_ull) >> 32)) |
Extracts the numerically most significant int from a long long int. | |
#define | U_PACK_LL_WITH_SHORTS(_3, _2, _1, _0) |
Packs a long long int with 4 shorts, specified in order from the numerically most significant short (_3) to the numerically least signicant short (_0). | |
#define | U_PACK_LL_WITH_BYTES(_7, _6, _5, _4, _3, _2, _1, _0) |
Packs a long long int with 8 bytes, specified in order from the numerically most significant byte (_7) to the numerically least signicant byte (_0). | |
#define | U_UNPACK_LL_LO_INT(_ull) ((unsigned int)(_ull)) |
Extracts the numerically least significant int from a long long. | |
Typedefs | |
typedef union _U_byte | U_byte |
Typedef for union _U_byte. | |
typedef struct _U_short_as_bytes | U_short_as_bytes |
Typedef for union _U_short_as_bytes. | |
typedef struct _U_int_as_shorts | U_int_as_shorts |
Typedef for union _U_int_as_shorts. | |
typedef struct _U_longlong_as_ints | U_longlong_as_ints |
Typedef for union _U_longlong_as_ints. | |
typedef union _U_short | U_short |
Typedef for union _U_short. | |
typedef union _U_int | U_int |
Typedef for union _U_int. | |
typedef union _U_longlong | U_longlong |
Typedef for union _U_longlong. |
CVS $Id: Unions.h,v 1.5 2011/03/24 20:50:58 apw Exp $
#define U_PACK_INT_WITH_BYTES | ( | _3, | |||
_2, | |||||
_1, | |||||
_0 | ) |
Value:
U_PACK_INT_WITH_SHORTS (U_PACK_SHORT_WITH_BYTES(_3, _2), \ U_PACK_SHORT_WITH_BYTES(_1, _0))
_3 | The numerically most significant byte | |
_2 | The numericallly second most significant byte | |
_1 | The numericallly third most significant byte | |
_0 | The numerically least significant byte |
Referenced by test_unions().
#define U_PACK_INT_WITH_SHORTS | ( | _hi, | |||
_lo | ) | ((((_hi)&0xffff) << 16) | (((_lo)&0xffff) << 0)) |
Packs an int with the numerically high and low shorts.
_hi | The numerically most significant short | |
_lo | The numerically least significant short |
#define U_PACK_LL_WITH_BYTES | ( | _7, | |||
_6, | |||||
_5, | |||||
_4, | |||||
_3, | |||||
_2, | |||||
_1, | |||||
_0 | ) |
Value:
U_PACK_LL_WITH_INTS (U_PACK_INT_WITH_BYTES(_7, _6, _5, _4), \ U_PACK_INT_WITH_BYTES(_3, _2, _1, _0))
_7 | The numerically most significant byte | |
_6 | The numericallly second most significant byte | |
_5 | The numericallly third most significant byte | |
_4 | The numerically fourth most significant byte | |
_3 | The numerically fifth most significant byte | |
_2 | The numericallly sixth most significant byte | |
_1 | The numericallly seventh most significant byte | |
_0 | The numerically least significant byte |
Referenced by test_unions().
#define U_PACK_LL_WITH_INTS | ( | _hi, | |||
_lo | ) |
Value:
((((((unsigned long long)(_hi))&0xffffffff)) << 32) | \ ((((_lo) &0xffffffff) << 0)))
_hi | The numerically most significant int | |
_lo | The numerically least significant int |
#define U_PACK_LL_WITH_SHORTS | ( | _3, | |||
_2, | |||||
_1, | |||||
_0 | ) |
Value:
U_PACK_LL_WITH_INTS (U_PACK_INT_WITH_SHORTS(_3, _2), \ U_PACK_INT_WITH_SHORTS(_1, _0))
_3 | The numerically most significant short | |
_2 | The numericallly second most significant short | |
_1 | The numericallly third most significant short | |
_0 | The numerically least significant short |
#define U_PACK_SHORT_WITH_BYTES | ( | _hi, | |||
_lo | ) | ((((_hi)&0xff) << 8) | (((_lo)&0xff) << 0)) |
Packs a short with the numerically high and low bytes.
_hi | The numerically most significant byte | |
_lo | The numerically least significant byte |
Referenced by test_unions().
#define U_UNPACK_INT_HI_SHORT | ( | _ui | ) | ((unsigned short)((_ui) >> 16)) |
Extracts the numerically most significant short from an int.
_ui | The int to extract the short from |
Referenced by test_unions().
#define U_UNPACK_INT_LO_SHORT | ( | _ui | ) | ((unsigned short)(_ui)) |
Extracts the numerically least significant short from an int.
_ui | The int to extract the short from |
Referenced by test_unions().
#define U_UNPACK_LL_HI_INT | ( | _ull | ) | ((unsigned int)((_ull) >> 32)) |
Extracts the numerically most significant int from a long long int.
_ull | The long long to extract the int from |
Referenced by test_unions().
#define U_UNPACK_LL_LO_INT | ( | _ull | ) | ((unsigned int)(_ull)) |
Extracts the numerically least significant int from a long long.
_ull | The long long to extract the int from |
Referenced by test_unions().
#define U_UNPACK_SHORT_HI_BYTE | ( | _us | ) | ((unsigned char)((_us) >> 8)) |
Extracts the numerically most significant byte from a short.
_us | The short to extract the byte from |
Referenced by test_unions().
#define U_UNPACK_SHORT_LO_BYTE | ( | _us | ) | ((unsigned char)(_us)) |
Extracts the numerically least significant byte from a short.
_us | The short to extract the byte from |
Referenced by test_unions().
Typedef for union _U_int.
The 32 bits can be assessed as
Typedef for union _U_longlong.
The 64 bits can be assessed as
Typedef for union _U_short.
The 16 bits can be assessed as