Check out my first novel, midnight's simulacra!

Endianness

From dankwiki

You oughtn't ever need deal with endianness unless you're doing one of three things:

  • Writing a specification for a network protocol or file format
  • Reading/writing to a network
  • Reading/writing to an external file

Compilation

If your compiler isn't properly folding down constant expressions involving byteswaps, the following are defined in linux's asm/byteorder.h:

  • __constant_htons()
  • __constant_ntohs()
  • __constant_htonl()
  • __constant_ntohl()