Add new comment

For byte swapping use

For byte swapping use something like ntohs() (actually this converts from big endian to your machine/host endianness, so it might be a noop if your machine is big endian as well) or, depending on your system/compiler, some incarnation of the bswap16() intrinsic/bultin function (e.g. __builtin_bswap16() for GCC, _byteswap_ushort() for MSVC, etc.)