From 90a99a3c095aa634e8768914e34d2cb84586615f Mon Sep 17 00:00:00 2001 From: cbdev Date: Thu, 7 Mar 2019 00:13:04 +0100 Subject: Use _CLOCK_MONOTONIC_RAW for timestamps on OSX --- portability.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'portability.h') diff --git a/portability.h b/portability.h index 71d72fc..25aee01 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 #define htobe16(x) OSSwapHostToBigInt16(x) -- cgit v1.2.3 From 20a6882a063404858588596bd3f12bdd9e53460a Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 3 Aug 2019 18:42:39 +0200 Subject: Windows build compatiblity --- portability.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'portability.h') diff --git a/portability.h b/portability.h index 25aee01..903ecd8 100644 --- a/portability.h +++ b/portability.h @@ -19,3 +19,20 @@ #define be64toh(x) OSSwapBigToHostInt64(x) #define le64toh(x) OSSwapLittleToHostInt64(x) #endif + +#ifdef _WIN32 + #define WIN32_LEAN_AND_MEAN + #include + #include + + #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) +#endif -- cgit v1.2.3 From 49855046f683deb7fdadc2c3d8caf513099b4803 Mon Sep 17 00:00:00 2001 From: cbdev Date: Wed, 4 Sep 2019 20:26:24 +0200 Subject: Use platform-independent specifiers for printf calls --- portability.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'portability.h') diff --git a/portability.h b/portability.h index 903ecd8..f0bfd07 100644 --- a/portability.h +++ b/portability.h @@ -35,4 +35,8 @@ #define htole64(x) (x) #define be64toh(x) _byteswap_uint64(x) #define le64toh(x) (x) + + #define PRIsize_t "Iu" +#else + #define PRIsize_t "zu" #endif -- cgit v1.2.3