aboutsummaryrefslogtreecommitdiffhomepage
path: root/portability.h
diff options
context:
space:
mode:
Diffstat (limited to 'portability.h')
-rw-r--r--portability.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/portability.h b/portability.h
index 71d72fc..f0bfd07 100644
--- a/portability.h
+++ b/portability.h
@@ -1,5 +1,7 @@
#ifdef __APPLE__
- #define CLOCK_MONOTONIC_RAW _CLOCK_MONOTONIC_RAW
+ #ifndef CLOCK_MONOTONIC_COARSE
+ #define CLOCK_MONOTONIC_COARSE _CLOCK_MONOTONIC_RAW
+ #endif
#include <libkern/OSByteOrder.h>
#define htobe16(x) OSSwapHostToBigInt16(x)
@@ -17,3 +19,24 @@
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)
#endif
+
+#ifdef _WIN32
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+ #include <winsock2.h>
+
+ #define htobe16(x) htons(x)
+ #define be16toh(x) ntohs(x)
+
+ #define htobe32(x) htonl(x)
+ #define be32toh(x) ntohl(x)
+
+ #define htobe64(x) _byteswap_uint64(x)
+ #define htole64(x) (x)
+ #define be64toh(x) _byteswap_uint64(x)
+ #define le64toh(x) (x)
+
+ #define PRIsize_t "Iu"
+#else
+ #define PRIsize_t "zu"
+#endif