Switch to custom byte swapping function.

GCC builtins like __bswap_32 are not portable between versions.
A good point. I also gave it a slightly better name.