fix for big endians

Include the <endian.h> header and set the WORDS_BIGENDIAN define according to BYTE_ORDER.