diff --git a/src/city.cc b/src/city.cc index b8aafab..41cd5ee 100644 --- a/src/city.cc +++ b/src/city.cc @@ -60,6 +60,24 @@ static uint32 UNALIGNED_LOAD32(const char *p) { #define bswap_32(x) OSSwapInt32(x) #define bswap_64(x) OSSwapInt64(x) +#elif defined(__sun) || defined(sun) + +#include +#define bswap_32(x) BSWAP_32(x) +#define bswap_64(x) BSWAP_64(x) + +#elif defined(__FreeBSD__) + +#include +#define bswap_32(x) bswap32(x) +#define bswap_64(x) bswap64(x) + +#elif defined(__OpenBSD__) + +#include +#define bswap_32(x) swap32(x) +#define bswap_64(x) swap64(x) + #elif defined(__NetBSD__) #include @@ -152,7 +170,7 @@ static uint32 Hash32Len13to24(const char *s, size_t len) { static uint32 Hash32Len0to4(const char *s, size_t len) { uint32 b = 0; uint32 c = 9; - for (int i = 0; i < len; i++) { + for (size_t i = 0; i < len; i++) { signed char v = s[i]; b = b * c1 + v; c ^= b;