Switch to custom byte swapping function.

GCC builtins like __bswap_32 are not portable between versions.
Adding htole32 would take no additional work at all.
You have merely misnamed your function's parameters: it does byte-swapping, whether from LE to BE or from BE to LE, it doesn't care which way.  So you can use exactly the same function here for htole32(), although it might be a good idea to rename the function's local parameters to avoid confusion (which is why my example code using a union called them src and dst instead of saying anything about their endianness).