1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix compile under MingW

This commit is contained in:
kwolekr 2013-01-23 02:21:26 -05:00
parent 035933f806
commit 69ba485415
3 changed files with 44 additions and 5 deletions

View file

@ -42,18 +42,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifdef _WIN32
#include <windows.h>
#define ALIGNOF(x) __alignof(x)
#define sleep_ms(x) Sleep(x)
#else
#include <unistd.h>
#include <stdint.h> //for uintptr_t
#define sleep_ms(x) usleep(x*1000)
#endif
#ifdef _MSC_VER
#define ALIGNOF(x) __alignof(x)
#define strtok_r(x, y, z) strtok_s(x, y, z)
#define strtof(x, y) (float)strtod(x, y)
#define strtoll(x, y, z) _strtoi64(x, y, z)
#define strtoull(x, y, z) _strtoui64(x, y, z)
#else
#include <unistd.h>
#include <stdint.h> //for uintptr_t
#define ALIGNOF(x) __alignof__(x)
#define sleep_ms(x) usleep(x*1000)
#endif
#ifdef __MINGW32__
#define strtok_r(x, y, z) mystrtok_r(x, y, z)
#endif
#define PADDING(x, y) ((ALIGNOF(y) - ((uintptr_t)(x) & (ALIGNOF(y) - 1))) & (ALIGNOF(y) - 1))