Determining endianness

The file <gulliver.h> contains macros to help resolve endian issues.

The first thing you may need to know is the target system's endianness, which you can find out via the following macros:

defined if little-endian
defined if big-endian

A common coding style in the header files (e.g., <gulliver.h>) is to check which macro is defined and to report an error if none is defined:

#if defined(__LITTLEENDIAN__)
// do whatever for little-endian
#elif defined(__BIGENDIAN__)
// do whatever for big-endian
#error ENDIAN Not defined for system

The #error statement will cause the compiler to generate an error and abort the compilation.