Add functions to swap endiannes or convert host to big/little endian This code should be very compiler friendly and should be optimized to single bswap instruction on x86.