GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBI / V0-1-1 > test_endianness / sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

U Union Reference

A union used to reference an integer both as a 32 bit integer and as an array of 4 bytes. More...

List of all members.

Public Attributes

unsigned int ui
unsigned char uc [4]


Detailed Description

A union used to reference an integer both as a 32 bit integer and as an array of 4 bytes.

By referencing the same integer as both a 32-bit integer and an array of 4 bytes, one can experimentally determine the endianness of the machine at run time.

If the machine is a little endian machine, element 0 of the array of 4 bytes will match the byte with the least significant portion of the integer, element 1 will match the next least significant portion and so forth.

If the machine is a big endian machine, element 3 of the array of 4 bytes will match the byte with the least significant portion of the integer, element 2 will match the next least significant portion and so forth.


Member Data Documentation

unsigned char U::uc[4]

Reference the value as an array of 4 bytes

Referenced by test_endianness().

unsigned int U::ui

Reference the value as a 32-bit integer

Referenced by test_endianness().


The documentation for this union was generated from the following file:

Generated on Thu Mar 24 14:07:08 2011 by  doxygen 1.5.8