More carefully check defines for endianness.
Fix typos.
Merge pull request #2931 from unknownbrackets/endian

Improve endian define handling and fix a couple typos