Brian Dessent wrote:
Lee Rhodes wrote:
Nonetheless, if I had to write low-level code that depended on ENDIANess,
what is the most robust/platform-independent way to make that determination
(and not pay run-time execution costs)?
Autoconf has the AC_C_BIGENDIAN macro that will determine the
endian-ness of the target at configure time.
And #include <endian.h> defines __BYTE_ORDER, __LITTLE_ENDIAN, and
__BIG_ENDIAN which can be tested at compile time.
You can also use htons/ntohs and ntonl/ntohl and they take care of it
for you.
David Daney