## Byte order macros

The endian-ness issues (that is the difference between big-endian and little-endian architectures) are important for the portable programs working with the external binary data (for example, data files or data coming from network) which is usually in some fixed, platform-independent format. The macros are helpful for transforming the data to the correct format.

wxINTXX_SWAP_ALWAYS
wxINTXX_SWAP_ON_BE
wxINTXX_SWAP_ON_LE

### wxINTXX_SWAP_ALWAYS

wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value)

wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value)

wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value)

wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value)

These macros will swap the bytes of the value variable from little endian to big endian or vice versa unconditionally, i.e. independently of the current platform.

### wxINTXX_SWAP_ON_BE

wxInt32 wxINT32_SWAP_ON_BE(wxInt32 value)

wxUint32 wxUINT32_SWAP_ON_BE(wxUint32 value)

wxInt16 wxINT16_SWAP_ON_BE(wxInt16 value)

wxUint16 wxUINT16_SWAP_ON_BE(wxUint16 value)

This macro will swap the bytes of the value variable from little endian to big endian or vice versa if the program is compiled on a big-endian architecture (such as Sun work stations). If the program has been compiled on a little-endian architecture, the value will be unchanged.

Use these macros to read data from and write data to a file that stores data in little-endian (for example Intel i386) format.

### wxINTXX_SWAP_ON_LE

wxInt32 wxINT32_SWAP_ON_LE(wxInt32 value)

wxUint32 wxUINT32_SWAP_ON_LE(wxUint32 value)

wxInt16 wxINT16_SWAP_ON_LE(wxInt16 value)

wxUint16 wxUINT16_SWAP_ON_LE(wxUint16 value)

This macro will swap the bytes of the value variable from little endian to big endian or vice versa if the program is compiled on a little-endian architecture (such as Intel PCs). If the program has been compiled on a big-endian architecture, the value will be unchanged.

Use these macros to read data from and write data to a file that stores data in big-endian format.