Switches a 16/32-bit value between big/little endian.