byte order macrosthe 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_alwayswxint32 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_bewxint32 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_lewxint32 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.
|