core: Adding workaround for missing <byteswap.h> on FreeBSD

This commit also fixes a couple of compilation issues with gcc 4.2.1

Change-Id: Iacc5a742b666849694b6ee947482e78340f74336
diff --git a/core/city-hash.cpp b/core/city-hash.cpp
index e0bebb4..7b9790a 100644
--- a/core/city-hash.cpp
+++ b/core/city-hash.cpp
@@ -69,6 +69,17 @@
 #define bswap_64(x) bswap64(x)
 #endif
 
+
+#elif defined(__FreeBSD__)
+
+// Based on https://code.google.com/p/freebsd/source/browse/sys/ofed/include/byteswap.h?spec=svn38a8350a629d959c8c5509221cd07ffb891b5a77&r=38a8350a629d959c8c5509221cd07ffb891b5a77
+
+#include <sys/types.h>
+#include <sys/endian.h>
+#define bswap_16(x) bswap16(x)
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
+
 #else
 
 #include <byteswap.h>