Use <sys/endian.h> and bswap32(x) on FreeBSD

This replaces <byteswap.h> and bswap_32(x) on Linux.