What is the native endianness of my platform?
Solved
General and Desktop
-
bool isBigEndian() { static const int i = 1; static bool endian= ( (*(char*)&i) == 0 ); return endian; }
https://developer.ibm.com/articles/au-endianc/
There are some Qt macros also:
Q_BIG_ENDIAN This macro represents a value you can compare to the macro Q_BYTE_ORDER to determine the endian-ness of your system. In a big-endian system, the most significant byte is stored at the lowest address. The other bytes follow in decreasing order of significance. #if Q_BYTE_ORDER == Q_BIG_ENDIAN ... #endif See also Q_BYTE_ORDER and Q_LITTLE_ENDIAN. Q_BYTE_ORDER