Doxygen Documentation |
||||||
Package: |
PBI |
|||||
Version: |
V0-0-3 |
Marked: |
(not marked) |
|||
Constituent: |
test_endianness |
Tag: |
rad750 |
Data Fields | |
unsigned int | ui |
unsigned char | uc [4] |
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.
|
Reference the value as an array of 4 bytes |
|
Reference the value as a 32-bit integer |