Switch to custom byte swapping function.

GCC builtins like __bswap_32 are not portable between versions.
Actually in this particular case there should not be a problem with strict pointer aliasing rules. The rules allow an exception for char*. It is assumed that char* always can aliase other types.