Switch to custom byte swapping function.

GCC builtins like __bswap_32 are not portable between versions.
The type name guarantees 32 bits; that this is 4 bytes is only guaranteed because CHAR_BIT is 8, which is why I said the two assertions are equivalent.  The assert is purely for pedagogic purposes, so don't bother if you don't care.