Embedding endianness information within data and sending and receiving
data with the embedded endianness information. Data may be contained in a
data structure. To embed endianness information in a data structure,
unused bits in a data structure are identified. A number of the unused
bits are then selected based on the possible unpacking combinations of
the data structure. The endian bit values are set to a pattern to
indicate the endianness of the data structure. Data that has been packed
by a transmitting module can be unpacked by a receiving module based on
the detected endian bits. An algorithm may be used to determine which
unused bits to select as the endian bits.